Databases · Middle · Question 30 of 75

Why can WHERE id NOT IN (SELECT user_id FROM bans) return no rows at all?

Explanation

x NOT IN (1, NULL) means x <> 1 AND x <> NULL, and the second part is unknown. This is a classic bug with nullable columns.

Further reading

Problem with a question

Databases · Middle · question 30

Test yourself

Take the Databases · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz