Data Base Lab
Islamic University – Gaza
Engineering Faculty
Computer Department
SQl Lab Activity
By :Eng.Alaa I.Haniy.
Part (a):
Make the following database on the “SQl Manegment studio “
Student
StdNo SName SCity
Activity
ActivityNo ActivityName ActivityPurpose ActivityCost
Note : cost must be greater than 50
StdActivity
StdNo ActivityNo Hours
-----------------------------------------------------------------------------------------------
A. Create the tables shown in the schema above
Insert four rows into the student table as following
StdNo SName SCity
S1 Ahmed Gaza
S2 Ali Ramallah
S3 Mohammed Ramallah
S4 Hesham Khanyounis
Insert four rows into the Activity table as following
ActivityNo ActivityName ActivityPurpose ActivityCost
A1 DELTA Social 100
A2 BITS Academic 150
A3 HELP Service 200
A4 SIGMA Social 100
Insert the following rows in StdActivity table
StudentNo ActivityNo Hours
S1 A1 10
S1 A2 5
S1 A3 9
S1 A4 15
S2 A1 10
S2 A4 5
S3 A1 9
Part (B):
Please perform the following queries
1. Retrieve the number and name of students who live in a city that begin with R
2. Retrieve the students number and name of those who are not registered in any
activity
3. Retrieve the name of students who work more than 5 hours at an activity whose cost
is more than 100
4. Retrieve the total hours for each activity
5. Retrieve the student name that have the max working hours