0% found this document useful (0 votes)
11 views6 pages

Lab#4 233070 DBMS

asdg

Uploaded by

233070
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

Lab#4 233070 DBMS

asdg

Uploaded by

233070
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

NAME : AHMED HASSAN

ROLL NO : 233070
DEPARTMENT : BSCGD 2A
LAB TASK : DBMS
Lab Task
Given the following database schema:
Student (snum: integer, sname: char(30), major: char(25), level: char(2))
Faculty (fid: integer, fname: char(30), deptid: integer)
Class (cname: char(40), meets_at: char(20), room: char(10), fid: integer |
fid REFS Faculty.fid)
Enrolled (snum: integer, cname: char(40) | snum REFS student.snum,
cname REFS class.name)

Write SQL expressions for each of the following queries and execute them:
Task 1:
Find the names of all juniors (Level = JR) who are enrolled in a class taught by ‘Ivana Teach’.

Task 2:
Find the names of faculty members that has taught classes only in room R128.
Task 3:
Find the names of classes taught by ‘Richard Jackson’ and their times when a class meet there.

Task 4:
Find the names of students majoring in ‘Computer Science’.

Task 5:
Find the names of classes taught by ‘John Williams’ in dept # 68.

Task 6:

For each class taught by ‘John Williams’, retrieve the name and age for students.

Task 7:
Find the names of students in ‘Computer Science’ major in descending age-wise.

Task 8:

Find distinct student ages in ‘Database Systems’ class in descending order.

Task 9:

List the name of ‘Christopher Garcia’s teachers.

Task 10:

Retrieve the snum and sname of students who have taken classes from both ‘Ivana Teach’ and ‘Linda
Davis’. (Both with simple and nested queries)

Task 11:

Find average age of students.

Task 12:
Find the average age of student in course: ‘Organic Chemistry’.

Task 13:

Find eldest student.

Task 14:
Find youngest student in ‘Electrical Engineering’ major.

Task 15:

Find eldest student in each level.

Task 16:

Find average age of students in each level

Task 17:
Find the number of distinct class rooms

Task 18:
Find the strength of students in each major.

Task 19:
Find strength of students in course: ‘Urban Economics’

Task 20:

Find the number of courses for student: ‘Karen Scott’

You might also like