SQL Server Tutorial
In SQL Server, NULL is an unknown value or a value for which data is not available.
IS NULL can be used in the WHERE clause to retrieve the NULL value from the table
Result is always NULL when NULL value is compared with any other value using comparison operators or any calculation is performed on a NULL value.
We cannot compare one NULL value with another, no two NULL values are equal.
In ascending order, NULL values are the first precedence to be displayed.
SELECT column_name1[, column_name2, ....] FROM table_name WHERE column_name IS NULL
here getting rows which column_name field has NULL value.
SELECT column_name1[, column_name2, ....] FROM table_name WHERE column_name IS NOT NULL
here getting rows which column_name field has non NULL value.
Let us consider the example 'Department' database table.
To get the rows which Head column value is null in Department table.
SELECT Id, Name, Head FROM Department WHERE Head IS NULLOutput:
To get the rows which Head column value is not null in Department table.
SELECT Id, Name, Head FROM Department WHERE Head IS NOT NULLOutput:
SQL Server Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us | Report website issues in Github | Facebook page | Google+ page