Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are given the following relations: Take(StudentID, CourseID) RequiredForGrad

ID: 3753648 • Letter: Y

Question

You are given the following relations:

Take(StudentID, CourseID)

RequiredForGraduation(CourseID)
The Take relation lists IDs of students and IDs of courses taken by the students. (Note that in this problem, we are assuming that each course has a unique ID, as opposed to the scheme we used in class.) The RequiredForGraduation relation lists the courses every student must take to graduate. The following query finds the students who have satisfied all the requirements for graduation.
SELECT StudentId

FROM Take AS T, RequiredForGraduation AS R

WHERE T.CourseID = R.CourseID

GROUP BY T.StudentID

HAVING COUNT(T.CourseId) = (SELECT COUNT(CourseId) FROM RequiredForGraduation);
You hate the HAVING clause and do not see the point of views. Rewrite this query without using views or the HAVING clause.

Explanation / Answer

If you have any doubts, please give me comment...

SELECT StudentID

FROM Take T

WHERE NOT EXISTS(

SELECT StudentID

FROM RequiredForGraduation R

WHERE NOT EXISTS(

SELECT CourseID

FROM Take T1

WHERE R.CourseID = T1.CourseID AND T.StudentID = T1.StudentID

)

);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote