Special value indicating unknown or inapplicable data.
Different from zero for numeric data types or blanks for character data types.
When arithmetic or comparison operators have one or more null operands, the result is null.
If a WHERE clause evaluates to null for values in a row, that row is not selected.
Prevents a column from having a NULL value.
Insertion or updates to rows with NOT NULL constraints are automatically rejected if null values are referenced.
To select rows with null values, the syntax can be as follows:
SELECT * FROM Employee WHERE salary IS NULL.
SELECT * FROM Employee WHERE salary IS NULL
This query will never return any rows since the WHERE clause evaluates to null for rows with NULL salary.
Using IS NULL and IS NOT NULL:
IS NULL
IS NOT NULL
IS NULL returns TRUE when the value in a column is null.
IS NOT NULL returns TRUE when the value in a column is not null.
Logical combinations involving NULL values:
x AND y results in NULL if either x or y is NULL; otherwise, it follows standard boolean logic.
x AND y
x OR y results in TRUE if either x or y is TRUE; if both are NULL, it yields NULL.
x OR y
NOT x results in NULL if x is NULL.
NOT x