Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write SQL queries for questions f-j using the following University schema Classroom(building, room number capacity) Department(dept name, building, budget) Course(course id, title, deptname, credits) Instructor(iid,

image text in transcribed

Write SQL queries for questions f-j using the following University schema Classroom(building, room number capacity) Department(dept name, building, budget) Course(course id, title, deptname, credits) Instructor(iid, name, dept name, salary) Section(course id, sec id, semester, year, building, room_number, time slot id) Teaches(iid, course id, sec id, semester, year) Student(s id, name, dept name, tot cred) Takes(s id, course id, sec id, semester, year, grade) Advisorfs id, Lid) Time_slot time slot id, day, start hr, start min, end_hr, end min) Prereq(course id, prereg id) Grade points (grade, points) f. (10 pts) Find the top 3 semesters in which the most number of courses were offered. (Treat Spring of 2009 and Spring of 2010 as two different semesters) Output columns: Semester, Year, NumberOfCourses Sort by: NumberOfCourses in descending order Semester Year NumberOfCourses g. (10 pts) Find the top 2 students who have taken the most number of courses Output columns: S ID, StudentName, NumberOfCourses Sort by: NumberOfCourses in descending order S ID StudentName NumberOfCourses h. (10 pts) Find the top 4 instructors whose courses have the maximum enrollment in all of their courses combined Output columns: InstructorName, TotalEnrollment Sort by: TotalEnrollment in descending order InstructorName TotalEnrollment i. (10 pts) List all the courses offered by the departments 'Comp. Sci' and 'History: Output should not contain any duplicates. Output columns: DepartmentName, CourselD Sort by: CourselD in ascending order DepartmentName CourselD j. (10 pts) List all the courses that have prerequisites offered by a different department. Output columns: Course id, Course_department, Prereq id, Prereq department Sort by: Course id in ascending order Course_id Course_dept Prereq id Prereq dept

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions