MySQL Functions, JSON, and Date Cheatsheet/Use COALESCE for fallback values

Return the first non-NULL expression.

Section: json and string functions

Use COALESCE for fallback values

sql
sql
SELECT COALESCE(display_name, full_name, email) AS label FROM users;
Explanation

Great for optional columns and layered display fallbacks.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing json and string functions
Extract a value from JSON
Read a path inside a JSON document.
OpenIn sheetsqlsame section
Update a JSON path
Write or replace a value inside a JSON document.
OpenIn sheetsqlsame section
Build JSON in a query
Construct a JSON object from scalar values.
OpenIn sheetsqlsame section
Concatenate strings
Join scalar values into one string.
OpenIn sheetsqlsame section
Map values with CASE
Transform values into labels inside a query.
OpenIn sheetsqlsame section
Get the current date and time
Return current timestamp values.