Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

NULLIF

Example

Evaluate two expressions

SELECT NULLIF(2525);

Definition and Usage

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

Syntax

NULLIF(expr1expr2)

Parameter Values

Parameter

Description

expr1,expr2

Required: The two expressions to compare.

Technical Details

Works in:

 From MySQL version 4.0

More Examples

Example

Compare two values

SELECT NULLIF(25“Hello”);

Example

Compare two values

SELECT NULLIF(“Hello”“world”);

Example

Compare two values

SELECT NULLIF(“2017-08-25”“2017-08-25”);