Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
159 views

Database Lab Activity

The document provides instructions for an SQL lab activity. It includes: 1) Creating 3 tables - Student, Activity, and StdActivity 2) Inserting sample data into the Student and Activity tables 3) Inserting relationship data into StdActivity 4) 5 queries to perform on the tables including retrieving student data based on city name, students not registered in activities, students working over 5 hours at expensive activities, total hours per activity, and student with max hours.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
159 views

Database Lab Activity

The document provides instructions for an SQL lab activity. It includes: 1) Creating 3 tables - Student, Activity, and StdActivity 2) Inserting sample data into the Student and Activity tables 3) Inserting relationship data into StdActivity 4) 5 queries to perform on the tables including retrieving student data based on city name, students not registered in activities, students working over 5 hours at expensive activities, total hours per activity, and student with max hours.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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

You might also like