You write a query to drop a few blocked customers. The blocked list has two real ids and one NULL. You expect everyone else. You get nothing.
That is the NOT IN plus NULL trap. It shows up in interviews and in production reports. Here it is on a small SQLite dataset, with every result taken from a real run on Python 3.13's sqlite3.
The tiny dataset
Five customers. One of them has no city yet.
SELECT id , name , city FROM customers ORDER BY id ;
Enter fullscreen mode
Exit fullscreen mode
1 | Asha | Pune 2 | Ravi | Delhi 3 | Meera | NULL 4 | Kabir | Pune 5 | Neha | Mumbai
Enter fullscreen mode
Exit fullscreen mode
A blocked list.…