Question: Consider the following relations: Student(snum: integer, sname: string, major: string, level: string, age: integer) Class(name: string, meets_at: time, room: string, fid: integer) Enrolled(snum: integer, cname:

Consider the following relations: Student(snum: integer, sname: string, major: string, level: string, age: integer) Class(name: string, meets_at: time, room: string, fid: integer) Enrolled(snum: integer, cname: string) Faculty (fid: integer, fname: string, deptid: integer)

The meaning of these relations is straightforward; for example, Enrolled has one record per student-class pair such that the student is enrolled in the class. Write the following queries in MySQL. No duplicates should be printed in any of the answers.

(1) Find the students of standing JR who have enrolled in some course which is conducted in room R128. (2) List the students who are older than 18 years and have a level of SR and whose major is not a branch of Engineering. (3) Find the classes for which no student has enrolled. (4) Find the names of students who have enrolled for classes by those faculty members whose combined enrollment of the courses that they teach is less than five. (5) List all faculty members, showing their id, name and the number of classes they teach. The number of classes of those who teach no classes must be shown as 0. (6) List all the courses with their names, where they are taught and the number of students enrolled for each. If no students are enrolled, show the number of students as 0.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!