• The question is one of membership, and the IN clause seems to be a very clear way to pose that question. After proper indexing, it yields the same query plan as the methods proposed, but in a more understandable query.

    /* Students that have taken the SQL Server test */

    SELECT s.*

    FROM dbo.Students AS s

    WHERE s.StID IN (SELECT StID FROM dbo.StudentExam WHERE ExamName = 'SQL Server')

    /* Students that have not taken the SQL Server test */

    SELECT s.*

    FROM dbo.Students AS s

    WHERE s.StID NOT IN (SELECT StID FROM dbo.StudentExam WHERE ExamName = 'SQL Server')