SpinTheMic
Pro

Interview practice question

Query suddenly returns zero rows

Data Engineering · SQL · Experienced

A query using WHERE id NOT IN (SELECT id FROM blocked_users) suddenly returns zero rows after a data change. What happened?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • A NULL appeared in blocked_users.id.
  • NOT IN with any NULL in the list evaluates to unknown for every row.
  • Result is zero rows, without an error.
  • Replace with NOT EXISTS or filter NULLs out.
  • Add a not_null test on that column.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics