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)

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes