Using the relational database given in lab work no. 2, write the following queries in SQL: 1) How many different courses are there in each department? Sort the list. 2) How many students do have an advisor in the computer engineering faculty? 3) For each department, find out the highest CGPA of a student. Sort the list. (Add a new column to the student table!) 4) How many instructors are advising more than three students? 5) Which department has the highest number of students? 6) Which courses have multiple prerequisites? Sort the list. 7) How many different instructors taught the “Computer Programming” course at least two times? 8) Which instructor taught the “Object-Oriented Programming” course the most time? You should also present the output of each query in the lab report. _________________________________________________________________ The relational database schemas are as follows: department(dept-name, building, budget) instructor(ID, name, dept-name, salary) student(ID, name, dept-name, tot-cred) advisor(s-ID, i-ID) course(course-id, title, dept-name, credits) teaches(ID, course-id, sec-id, semester, year) takes(ID, course-id, sec-id, semester, year, grade) classroom(building, room-number, capacity) time-slot(time-slot-id, day, start-time, end-time) section(course-id, sec-id, semester, year, building, room-number, time-slot-id) prereq(course-id, prereq-id)
Using the relational
1) How many different courses are there in each department? Sort the list.
2) How many students do have an advisor in the computer engineering faculty?
3) For each department, find out the highest CGPA of a student. Sort the list. (Add a new column to the student table!)
4) How many instructors are advising more than three students?
5) Which department has the highest number of students?
6) Which courses have multiple prerequisites? Sort the list.
7) How many different instructors taught the “Computer Programming” course at least two times?
8) Which instructor taught the “Object-Oriented Programming” course the most time?
You should also present the output of each query in the lab report.
_________________________________________________________________
The relational database schemas are as follows:
department(dept-name, building, budget)
instructor(ID, name, dept-name, salary)
student(ID, name, dept-name, tot-cred)
advisor(s-ID, i-ID)
course(course-id, title, dept-name, credits)
teaches(ID, course-id, sec-id, semester, year)
takes(ID, course-id, sec-id, semester, year, grade)
classroom(building, room-number, capacity)
time-slot(time-slot-id, day, start-time, end-time)
section(course-id, sec-id, semester, year, building, room-number, time-slot-id)
prereq(course-id, prereq-id)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps