Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello can anyone help me out here, I can't make any sense into it. thank you University Schema to answer the question: create table classroom

Hello can anyone help me out here, I can't make any sense into it. thank you

University Schema to answer the question:

create table classroom (building varchar(15), room_number varchar(7), capacity numeric(4,0), primary key (building, room_number) );

create table department (dept_name varchar(20), building varchar(15), budget numeric(12,2) check (budget > 0), primary key (dept_name) );

create table course (course_id varchar(8), title varchar(50), dept_name varchar(20), credits numeric(2,0) check (credits > 0), primary key (course_id), foreign key (dept_name) references department on delete set null );

create table instructor (ID varchar(5), name varchar(20) not null, dept_name varchar(20), salary numeric(8,2) check (salary > 29000), primary key (ID), foreign key (dept_name) references department on delete set null );

create table section (course_id varchar(8), sec_id varchar(8), semester varchar(6) check (semester in ('Fall', 'Winter', 'Spring', 'Summer')), year numeric(4,0) check (year > 1701 and year

create table teaches (ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), primary key (ID, course_id, sec_id, semester, year), foreign key (course_id,sec_id, semester, year) references section on delete cascade, foreign key (ID) references instructor on delete cascade );

create table student (ID varchar(5), name varchar(20) not null, dept_name varchar(20), tot_cred numeric(3,0) check (tot_cred >= 0), primary key (ID), foreign key (dept_name) references department on delete set null );

create table takes (ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), grade varchar(2), primary key (ID, course_id, sec_id, semester, year), foreign key (course_id,sec_id, semester, year) references section on delete cascade, foreign key (ID) references student on delete cascade );

create table advisor (s_ID varchar(5), i_ID varchar(5), primary key (s_ID), foreign key (i_ID) references instructor (ID) on delete set null, foreign key (s_ID) references student (ID) on delete cascade );

create table time_slot (time_slot_id varchar(4), day varchar(1), start_hr numeric(2) check (start_hr >= 0 and start_hr = 0 and start_min = 0 and end_hr = 0 and end_min

create table prereq (course_id varchar(8), prereq_id varchar(8), primary key (course_id, prereq_id), foreign key (course_id) references course on delete cascade, foreign key (prereq_id) references course );

image text in transcribed

For the following, use the University schema from the SQL dass exercise. Write SQL queries (a) Using takes, the enrollment in each course. Display the course ID and the enrollment. (b) Display the course ID and enrollment of those courses with an enrollment of two or fewer (e) Using asub query, display the course ID and enrollment of the course with the maximum (d) Using asub query, display the course IDand enrollment of the counses with the minimum (e) The enrollment in each section of each course. Display the course ID, the section ID and The course IDs of those counses in teaches with a course ID that begins with BIO Each course ID should be displayed only once. (g) Using a sub-query and IN, the names of those instructors who have taught one or more Each name should be displayed only once. of those courses. (h) The names of those instructors who have taught all of those courses. Each name should be displayed only once. This time, you may not assume that SQL has a DIV operator. Instead, implement division using the "counting technique described on slides 29 and 30 of the On Making Relational Division Comprehensible presentation available on the course web site on Note: If you're not careful, you'll be countingsectious of courses rather than courses. You queries should be written in such a way that they would work correctly with any instance of the database

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

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions