Javatpoint Logo
Javatpoint Logo

SQL Server IS NULL Condition (Operator)

The SQL Server IS NULL operator is used to test for a NULL value.

Syntax:

Parameter explanation

expression: It specifies a value whether it is NULL.

Note:
  • If the expression is NULL value then the condition evaluates to TRUE.

  • If expression is not a NULL value, the condition evaluates to FALSE.


IS NULL Operator with SELECT Statement

Example:

Output:

SQL Is null condition 1

IS NULL Operator with INSERT Statement

Example:

Output:

SQL Is null condition 2

Note: This displays "0 rows affected" because there is no NULL value in name in the "Employees" table.


IS NULL Operator with UPDATE Statement

Example:

Update the salary of the employees in "Employees" table and set to 100000 where salary is NULL.

Output:

SQL Is null condition 3

You can verify it by using SELECT query:

SQL Is null condition 4

IS NULL Operator with DELETE Statement

Delete the employees from the "Employees" table where age is NULL.

Example:

Output:

SQL Is null condition 5

You can verify it by using SELECT query:

SQL Is null condition 6

You can see that there is no NULL value in age in the above table.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA