Delete all courses that no one is enrolled in. Consider the following library da
ID: 3593311 • Letter: D
Question
Delete all courses that no one is enrolled in.
Explanation / Answer
Hi, the query for it will be:-
DELETE FROM course WHERE courseid NOT IN ( select courseid from enroll);
Here we are using a subquery which gives us all the courseid in which students are enrolled. And then we specify to delete all courses, other than the ones whose courseid were returned by the subquery.
Kindly let me know if you have any doubts!
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.