Given the Actors table:
+-----------+------+
| Name      | Year |
+-----------+------+
| Nicolas   | 1980 | 
| Leonardo  | 1988 |
| Robert    | 1970 | 
| Adam      | NULL | 
+-----------+------+
How many records will the following query return?
SELECT * FROM Actors
WHERE Year IN (1970,1988,NULL);
Explanation
IS NULL or IS NOT NULL statements should be used to check for null / not null values.
All other types of comparisons (like =NULL, <>NULL, IN (NULL, ...)) are unreliable since they are evaluated to different results in different relational database management systems (False, UNKNOWN)
SQL
SQL Quiz
Start Quiz

or Read more about SQL Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback