• I've been caught out on the QotD before by not reading the question properly, but I agree that the SQL being different to the actual quesiton seemed a little overly confusing.

    However, as there's 4 records in the table, regardless of knowledge of the NULLIF function surely the output was always going to be all 4 options?

    Perhaps to test knowledge of NULLIF, the question might have been better to include NULLIF as a where clause, something like:

    select

    id,

    nullif(y,0) as 'test 1',

    nullif(y,9) as 'test 2'

    from

    #whatif

    where

    nullif(y,0) is null

    or nullif(y,9) is null

    and then have the same 4 answers with a "Check all that apply" option?