NOT IN and the NULL Trap
Return contacts whose city is not Pune and not Delhi, including those with an unknown (NULL) city. Order by id.
Table schema
Contacts(id INT PRIMARY KEY, name VARCHAR(20), phone VARCHAR(12), age INT, city VARCHAR(10))Sample data
id | name | phone | age | city
1 | Anita Rao | 98200-11111 | 25 | Pune
2 | Arun Das | 98100-22222 | 31 | Delhi
3 | Bela Shah | 70000-33333 | 45 | Pune
4 | Chirag Rao | 98200-44444 | NULL | Mumbai
5 | Anil Roy | 99999-55555 | 19 | NULL
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.