Question: USE CSIS 3 3 0 0 M 1 ; - - Drop tables if they exist ( for testing purposes, only use them if you

USE CSIS3300M1;
-- Drop tables if they exist (for testing purposes, only use them if you need to drop tables.)
IF OBJECT_ID('Faculty','U') IS NOT NULLIF OBJECT_ID('Courses','U') IS NOT NULLIF OBJECT_ID('Department_Heads', 'U') IS NOT NULLIF OBJECT_ID('Prerequisites','U') IS NOT NULL DROP CONSTRAINT FK_Prerequisites_Courses;
IF OBJECT_ID('Enrollment','U') IS NOT NULL DROP CONSTRAINT FK_Enrollment_Courses;
IF OBJECT_ID('Students','U') IS NOT NULLUsing NoSQL to answer these below questions INSERT INTO Faculty (faculty_id, name, department, salary) VALUES
(10101, 'Srinivasan', 'Comp. Sci.',65000),
(12121,'Wu', 'Finance', 90000),
(15151, 'Mozart', 'Music', 40000),
(22222, 'Einstein', 'Physics', 95000),
(32343,'El Said', 'History', 60000),
(33456, 'Gold', 'Physics', 87000),
(45565, 'Katz', 'Comp. Sci.',75000),
(58583, 'Califieri', 'History', 62000),
(76543, 'Singh', 'Finance', 80000),
(76766, 'Crick', 'Biology', 72000),
(83821, 'Brandt', 'Comp. Sci.',92000),
(98345, 'Kim', 'Elec. Eng.',80000); INSERT INTO Courses (course_id, course_name, department, credits) VALUES
('BIO-101', 'Intro. to Biology', 'Biology', 4),
('BIO-301', 'Genetics', 'Biology', 4),
('BIO-399', 'Computational Biology', 'Biology', 3),
('CS-101', 'Intro. to Computer Science', 'Comp. Sci.',4),
('CS-190', 'Game Design', 'Comp. Sci.',4),
('CS-315', 'Robotics', 'Comp. Sci.',3),
('CS-319', 'Image Processing', 'Comp. Sci.',3),
('CS-347', 'Database System Concepts', 'Comp. Sci.',3),
('EE-181', 'Intro. to Digital Systems', 'Elec. Eng.',3),
('FIN-201', 'Investment Banking', 'Finance', 3),
('HIS-351', 'World History', 'History', 3),
('MU-199', 'Music Video Production', 'Music', 3),
('PHY-101', 'Physical Principles', 'Physics', 4); ('Biology', 'Crick', 76766),
('Comp. Sci.', 'Brandt', 83821),
('Elec. Eng.', 'Kim', 98345),
('Finance','Wu',12121),
('History','El Said', 32343),
('Music', 'Mozart', 15151),
('Physics', 'Einstein', 22222);
INSERT INTO Prerequisites (course_id, prereq_id) VALUES
('BIO-301', 'BIO-101'),
('BIO-399', 'BIO-101'),
('CS-190','CS-101'),
('CS-315','CS-101'),
('CS-319','CS-101'),
('CS-347','CS-101'),
('EE-181','PHY-101'); INSERT INTO Students (id, name, dept_name, total_credit) VALUES
(1, 'John Doe', 'Comp. Sci.',30),
(2, 'Jane Smith', 'Biology', 40),
(3, 'Alice Johnson', 'Physics', 35),
(4, 'Robert Brown', 'History', 20),
(5, 'Emily Wilson', 'Comp. Sci.',25),
(6, 'Michael Clark', 'Finance', 30),
(7, 'Sarah Lewis', 'Music', 28),
(8, 'David Lee', 'Elec. Eng.',32),
(9, 'Jessica Miller', 'History', 27),
(10, 'Ryan Martinez', 'Physics', 23);INSERT INTO Enrollment (course_id, student_id, semester, year, instructor, room_number, grade) VALUES
('BIO-101',2, 'Summer', 2017, 'Crick', '514','B'),
('BIO-301',1, 'Summer', 2018, 'Crick', '514','A'),
('CS-101',1, 'Fall', 2017, 'Mozart', '101','B'),
('CS-101',3, 'Spring', 2018, 'Mozart', '101','F'),
('CS-190',4, 'Spring', 2017, 'Brandt', '3128','A'),
('CS-190',6, 'Spring', 2017, 'Brandt', '3128','A'),
('CS-315',5, 'Spring', 2018, 'Singh', '120','D'),
('CS-319',5, 'Spring', 2018, 'Singh', '100','B'),
('CS-319',2, 'Spring', 2018, 'Brandt', '3128','A'),
('CS-347',1, 'Fall', 2017, 'Brandt', '3128','
--Q1: Write a noSQL to list all courses taught within the same department as Professor Kim.
-- List Course ID, Course Name, Department Name and Professor's name.
--Q2: Write a NoSQL to Calculate the total number of students enrolled in each course in Fall 2017.
-- List Course Id, Course Name and Total No of Enrollment.
--Q3: Write a noSQL to Identify faculty members who teach at least one course with 3 credits
-- List Faculty ID, Faculty Name, Course ID and Course Names.
--Q4: Write a noSQL to Find the average salary of all faculty members who are not department heads
-- List AVG salary only.
--Q5: Write a noSQL to List all courses with enrollment counts ordered by the number of enrolled students (ascending order).
-- List Course Id, Course Name and No of Enrollment.
--Q6: Write a noSQL to Find the names of all students who have not enrolled in any course.
-- List Student Id and Student Name.
--Q7: Write a noSQL to List all departments along with the total number of faculty members in each department, Order by lowest to highest.
-- List Dept Name and No of Faculty Members
--Q8: Write a noSQL to Identify the names of all students who are enrolled in exactly one course.
-- List Student ID and Name
--Q9: Write a noSQL to Retrieve the courses that have no enrollment records.
-- List Student ID and Name
--Q10: Write a noSQL to Identify the names of all students who have earned a 'B' grade in at least one course
-- List Student ID, Name and Course Name.
--Q11: Write a noSQL to List all courses that have not been taught in Spring 2018.-- List Course ID, Name and Dept Name.
--Q12: Write a noSQL to Find courses that have prerequisites in the same department. -- List course ID, course name, and prerequisite ID.
USE CSIS 3 3 0 0 M 1 ; - - Drop tables if they

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 Programming Questions!