campus connect
campus connect
USE CAMPUS_CONNECT_DB;
-- Create tables
Sname VARCHAR(50),
Major VARCHAR(50),
Level VARCHAR(2),
Age INTEGER
);
Fname VARCHAR(50),
Deptid INTEGER
);
Meets_at VARCHAR(50),
Room VARCHAR(10),
Fid INTEGER,
);
Snum INTEGER,
Cname VARCHAR(50),
);
(1, 'Physics101'),
(1, 'DBMS'),
(2, 'Math201'),
(3, 'Chemistry301'),
(4, 'Biology401'),
(5, 'Computer501');
-- i. Find the names of all Juniors (level = JR) who are enrolled in a class taught by Prof. Harshith
-- ii. Find the names of all classes that either meet in room R128 or have five or more Students enrolled.
FROM CLASS
OR Cname IN (
SELECT Cname
FROM ENROLLED
GROUP BY Cname
);
-- iii. Find the names of all students who are enrolled in two classes that meet at the same time.
FROM STUDENT s
-- iv. Find the names of faculty members who teach in every room in which some class is taught.
where fid in
(select fid from class group by fid having count(*)>=(select count(distinct room)from class)) ;