SQL NULLIF Function

Example

Compare two expressions:

SELECT NULLIF(25, 25);

Definition and Usage

The NULLIF() function returns NULL if two expressions are equal, otherwise it returns the first expression.

Syntax

NULLIF(expr1, expr2)

Continue reading SQL NULLIF Function

SQL COALESCE Function

Example

Return the first non-null value in a list:

SELECT COALESCE(NULL, NULL, NULL, 'iampsp.com', NULL, 'Example.com');

Definition and Usage

The COALESCE() function returns the first non-null value in a list.

Syntax

COALESCE(val1, val2, ...., val_n)

Continue reading SQL COALESCE Function