Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SQL Programming THE INPUT DATA : create table student (sid); create table course (cid); create table prerequisite (cid, pre_cid); create table record (sid, cid, qtr,

SQL Programming

THE INPUT DATA :

create table student (sid); create table course (cid); create table prerequisite (cid, pre_cid); create table record (sid, cid, qtr, year, grade);

insert into student values ('A_001'); insert into student values ('A_002'); insert into student values ('A_003'); insert into student values ('A_004'); insert into student values ('A_005'); insert into student values ('A_006');

insert into course values ('CSE105'); insert into course values ('CSE107'); insert into course values ('CSE132A'); insert into course values ('CSE132B'); insert into course values ('CSE132X');

insert into prerequisite values ('CSE132B', 'CSE132A'); insert into prerequisite values ('CSE132X', 'CSE132B'); insert into prerequisite values ('CSE132X', 'CSE107');

insert into record values ('A_001', 'CSE105', 'F', 2015, 3); insert into record values ('A_001', 'CSE132A', 'F', 2015, 4);

insert into record values ('A_002', 'CSE132A', 'S', 2016, 4); insert into record values ('A_003', 'CSE132A', 'S', 2016, 3);

insert into record values ('A_001', 'CSE132B', 'F', 2016, 1); insert into record values ('A_002', 'CSE132B', 'F', 2016, 4); insert into record values ('A_003', 'CSE132B', 'F', 2016, 2); insert into record values ('A_004', 'CSE132A', 'F', 2016, 2); insert into record values ('A_005', 'CSE132A', 'F', 2016, 3); insert into record values ('A_002', 'CSE107', 'F', 2016, 4); insert into record values ('A_003', 'CSE107', 'F', 2016, 4); insert into record values ('A_005', 'CSE107', 'F', 2016, 2);

insert into record values ('A_002', 'CSE105', 'W', 2017, 4); insert into record values ('A_003', 'CSE105', 'W', 2017, 3); insert into record values ('A_004', 'CSE105', 'W', 2017, 3); insert into record values ('A_005', 'CSE105', 'W', 2017, 2); insert into record values ('A_006', 'CSE105', 'W', 2017, 1); insert into record values ('A_004', 'CSE132B', 'W', 2017, 4); insert into record values ('A_005', 'CSE132B', 'W', 2017, 2);

insert into record values ('A_001', 'CSE132X', 'S', 2017, 4); insert into record values ('A_002', 'CSE132X', 'S', 2017, 4); insert into record values ('A_003', 'CSE132X', 'S', 2017, 3); insert into record values ('A_004', 'CSE132X', 'S', 2017, 4); insert into record values ('A_005', 'CSE132X', 'S', 2017, 2); insert into record values ('A_006', 'CSE107', 'S', 2017, 3);

List, for each quarter, the number of courses with fewer than 5 students enrolled that quarter. The answer should have attributes{qtr,year,num}. if in a given quarter there are no courses with fewer than 5 students, the number of such courses for that quarter should be 0. and should be included in the answer. and the result should look something like this:

Reference: ('S', 2015, 0) ('S', 2016, 1) ('W', 2017, 1) ('F', 2015, 3) ('S', 2017, 0) ('F', 2016, 2) ('W', 2016, 1) 

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 Theory Icdt 99 7th International Conference Jerusalem Israel January 10 12 1999 Proceedings Lncs 1540

Authors: Catriel Beeri ,Peter Buneman

1st Edition

3540654526, 978-3540654520

Students also viewed these Databases questions