logo

SQL NULL Values

IS NULL, IS NOT NULL Operators

Attributes can have NULL values if permitted by the schema definition for a table (i.e., no NOT NULL constraint). NULL represents a missing value, unknown value, non-existent, or non-applicable value. A NULL value in a table is a value in a field that appears to be blank (empty), meaning it has no value.

Note: A NULL value is different from a zero value or a field that contains spaces. A field with a NULL value is one that has been left blank during record creation.

Example Table

⇒ The result of any arithmetic expression involving NULL is NULL.

⇒ The result of a WHERE clause condition is false if it evaluates to NULL.

⇒ AND, OR, and NOT operators handle NULL as follows:

AND OR Operator

⇒ It is not possible to test for NULL values with comparison operators, such as =, <, or <>.

⇒ For comparison, SQL uses the IS NULL and IS NOT NULL operators instead.

IS NULL Operator

The IS NOT NULL operator is the opposite of the IS NULL operator. It is used to check for NOT NULL values (or non-empty values). It returns TRUE if a NULL value is not found; otherwise, it returns FALSE. It can be used in a SELECT, UPDATE, or DELETE statement with the WHERE clause.

SQL IS NULL Operator

IS NOT NULL Operator

The IS NOT NULL operator is the opposite of the IS NULL operator. It is used to check for NOT NULL values (or non-empty values). It returns TRUE if a NULL value is not found; otherwise, it returns FALSE. It can be used in a SELECT, UPDATE, or DELETE statement with the WHERE clause.

SQL IS NOT NULL Operator
Next ❯ ❮ Previous
discription of faastop website
logo