Final answer:
The correct query to find students who are enrolled in all classes is option B.
Step-by-step explanation:
The correct answer is option B: SELECT SSN FROM Enrollment GROUP BY SSN HAVING COUNT(DISTINCT Class) = (SELECT COUNT(DISTINCT Class) FROM Classes);
This query will select all students (SSN) from the Enrollment table who are enrolled in all classes. It groups the records by SSN and filters the result by the number of distinct classes each student is enrolled in, comparing it to the total number of distinct classes in the Classes table using the HAVING clause.
This method ensures that only students who are enrolled in all classes will be returned in the result, ordered by SSN.