How to filter Rows with Null Values in Select Statement in SQL Server - SQL Server / TSQL Tutorial Part 110

Scenario:

Let's say that you are working as SQL Server developer. You need to write two queries
  1) Return all the records from dbo.Customer table where Address column has Null values
  2) Return only the records from dbo.Customer table where Address column has the values other than Null.

Solution : 

We can use Where clause in our Select statement to return null records or not null records. Let's create dbo.Customer table first and insert couple of records.

--Create dbo.Customer table
Create table dbo.Customer(
Id int,
Name VARCHAR(100),
Address VARCHAR(100))

--Insert records in dbo.Customer table
Insert into dbo.Customer
Values(1,'Aamir','XyZ Address')
,(2,'Raza',Null)

--Return all records from dbo.Custoemr Table
Select * From dbo.Customer

Return all records from a table by using Select statement in SQL Server Database - SQL Server / TSQL Tutorial

1) Now if we want to get all the records where Address column has Null values. our query will be like below.

Select * From dbo.Customer
where Address is Null
How to get records with Null values in Select query in SQL Server Database - SQL Server / TSQL Tutorial

2) If we want to get the records where Address column has values beside Null, we will be using below query.

Select * From dbo.Customer
where Address is not Null
Get all the records from table where column has the value beside Null values in SQL Server Database