Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions