How To Check For NULL Values Correctly In SQL

SELECT PatientId FROM Patients WHERE Surname = NULL  --  THIS IS WRONG
SELECT PatientId FROM Patients WHERE Surname is NULL  --  THIS IS CORRECT

SELECT PatientId FROM Patients WHERE Surname != NULL  --  THIS IS WRONG
SELECT PatientId FROM Patients WHERE Surname is not NULL  --  THIS IS CORRECT

2 thoughts on “How To Check For NULL Values Correctly In SQL

  1. This is the correct blog for everyone who wants to learn about this subject. You realize much its virtually hard to argue with you (not too I actually would want…HaHa). You definitely put a new spin on a topic thats been discussing for years. Excellent stuff, only great!

    Like

Leave a reply to Tom Cancel reply