DATABASE - Answer 5-8 Answer 5-8 only Given the following samples of larger tabl
ID: 3862972 • Letter: D
Question
DATABASE - Answer 5-8
Answer 5-8 only
Given the following samples of larger tables, give the queries for the problems below STUDENT Name StudentID Class Major CS Brown Class is 1 for Freshman, 2 for Sophomore, 3 for Junior and 4 for Seniors COURSE Credit hours CourselD Name Department CS101 intro. to Computer Science CS191 Discrete Struct I 3 CS282 Assembly Language 4 OBOE 101 OBOA Freshman Oboe SECTION SectionID Course ID Semester Year Faculty ID 2014 OBOE 101 BBishop 781 CS101 541 2014 KBingham 2014 552 CS101 BHare CS101 2014 BHare 448 662 CS191 FS 2014 XLiuExplanation / Answer
Here is the code for the queries:
/*5. Retrieve Names of all the courses taught by KBingham in 2012, and 2013.*/
SELECT Name FROM Course C, Section S WHERE C.CourseID == S.CourseID
AND FacultyID == 'KBingham'
AND Year == 2012 OR Year = 2013;
/*6. Get all the years, semesters, faculty, and office of that faculty, that have
taught course CS101. */
SELECT S.Year, S.Semester, S.FacultyID, I.Office FROM Section S, Instructor I
WHERE I.FacultyID == S.FacultyID
AND S.CourseID == 'CS101';
/*7. Retrieve the name and grades for all CS Majors. */
SELECT S.Name, G.grade FROM Student S, Grade G
WHERE S.StudentID == G.StudentID
AND S.Major == 'CS';
/*8. Retrieve the count of students in each department.*/
SELECT Major, count(StudentID) FROM Student GROUP BY Major;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.