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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: