Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

COALESCE

Example

Return the initial non-null value from a list.

SELECT COALESCE(NULLNULLNULL‘W3Schools.com’NULL‘Example.com’);

Definition and Usage

The COALESCE() function retrieves the first non-null value from a list of arguments.

Syntax

COALESCE(val1val2….val_n)

Parameter Values

Parameter

Description

val1, val2, val_n

Required. The values to evaluate

Technical Details

Works in:

 From MySQL version 4.0

More Examples

Example

Retrieve the initial non-null value from a list.

SELECT COALESCE(NULL12‘W3Schools.com’);