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 SQL. No duplicates should be printed in any of the answers. (1) Find the name of the oldest student who is either a Finance major or enrolled in a course taught by Linda Davis. (2) Find the names of all classes that either meet in room 20 AVW or have five or more students enrolled. (3) Find the names of faculty members who teach in every room in which some class is taught. (4) Find the names of faculty members who teach the maximum number of classes. (5) Find the names of faculty members who do not teach any class.

(6) For each age value that appears in Students, find the level value that appears most often. For example, if there are more FR level students aged 18 than SR, JR, or SO students aged 18, you should print the pair (18, FR). (7) Find the number of courses conducted per room. (8) Find the courses conducted in room R128 for which at least one student has enrolled. (9) Find the times at which classes occur for those courses for which at least one student has enrolled. (10) Find the students of standing JR who have enrolled in some course which is conducted in room R128. (11) List the students who are older than 18 years and have a level of SR and whose major is not a branch of Engineering. (12) Find the classes for which no student has enrolled. (13) 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. (14) 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. (15) 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!