thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Data & Analytics · Foundational

COALESCE Function

A function that returns the first non-NULL argument in its list.

Definition

COALESCE is the ANSI way to replace NULLs with defaults. Vendor variants include ISNULL (SQL Server), NVL (Oracle) and IFNULL (MySQL, Snowflake, BigQuery). The arguments should have compatible data types.

Example

SELECT COALESCE(MobilePhone, WorkPhone, 'N/A') FROM Contacts;

Exam tip

Oracle exams use NVL and NVL2; COALESCE is the portable equivalent.

Related terms