Syntax

SQL Replace NULL with a Default Syntax

In SQL, replace null with a default: returns the first non-null value — COALESCE(phone, 'n/a')

Quick Answer

Syntax
COALESCE(phone, 'n/a')
SQLSyntax

Replace NULL with a Default

Code example
COALESCE(phone, 'n/a')

Returns the first non-null value.

Learn More

How to replace null with a default in SQL

  1. Open your SQL file or editor.
  2. Copy the example, then replace its sample names and values for your code.

SQL Replace NULL with a Default Syntax

Use COALESCE(phone, 'n/a').

Related Syntax References

Frequently asked questions

What is the SQL syntax for replace null with a default?

Use this pattern: COALESCE(phone, 'n/a')

Can I copy this SQL code example?

Yes. Use Copy code and adapt the example to your program.

Is this SQL syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify