Name

COALESCE( )

Synopsis

COALESCE(column[,  . . . ])

This function returns the leftmost non-NULL string or column in a comma-separated list. If all elements are NULL, the function returns NULL.

SELECT COALESCE(col1, col2, col3)
   FROM table1;

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.