COALESCE() in MySQL — How It Works

What the MySQL COALESCE() function does, with an example.

Published October 21, 2026

COALESCE() returns the first non-NULL value from a list of arguments.

Key points

  • Part of standard SQL functions available in MySQL for working with query results

Example

SELECT COALESCE(nickname, first_name, "Unknown") FROM users;
More SQL articles