SQL Server – <> and Null

Where with not equal

<> not equal will include NULL column, so if table has null value, consider to add null check statement.

SELECT empid, firstname, lastname, country, region, city
FROM HR.Employees
WHERE region <> N'WA';

SELECT empid, firstname, lastname, country, region, city
FROM HR.Employees
WHERE region <> N'WA'
OR region IS NULL;
This entry was posted in Uncategorized. Bookmark the permalink.