





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






The division operator is used when we have to evaluate queries which contain the keyword ALL. Some instances where division operator is used are:
Student_Name Course Robert Databases Robert Programming Languages David Databases David Operating Systems Hannah Programming Languages Hannah Machine Learning Tom Operating Systems Table 2: Course_Required → It consists of the courses that one is required to take in order to graduate. Course Databases
David Hannah Tom
Robert Databases Robert Programming Languages David Databases David Programming Languages Hannah Databases Hannah Programming Languages Tom Databases Tom Programming Languages
(SELECT * FROM CannotGraduate WHERE CannotGraduate.Student_name = AllStudents.Student_name) The results will be as follows: Student_name Robert Hence we just learned, how different steps can lead us to the final answer. Now let us see how to write all these 5 steps in one single query so that we do not have to create so many tables. SELECT DISTINCT x.Student_Name FROM Course_Taken AS x WHERE NOT EXISTS(SELECT * FROM Course_Required AS y WHERE NOT EXISTS(SELECT * FROM Course_Taken AS z WHERE z.Student_name = x.Student_name AND z.Course = y.Course )) Student_name