Similar questions 2 more →
SQL & Queries

Answer & solution
Official answer: 2
The intended NOT EXISTS test succeeds when the set of D01 courses minus the student's registered courses is empty. The D01 course set is {C11, C12}. Therefore the intended query returns 2 student rows. Source syntax discrepancy: the printed SQL says NOT EXIST, missing the final S, and uses typographic double quotes around D01. Executable standard SQL needs NOT EXISTS and a single-quoted character literal. The official numeric answer assumes these obvious syntax repairs; the literal printed statement is not valid standard SQL.
The missing-D01-course sets are S01:∅, S02:{C12}, S03:{C11,C12}, S04:∅, S05:{C12}. NOT EXISTS accepts only empty sets. A student’s own department is not a filter in the outer query; only coverage of the D01 courses matters.