AI engineering glossary · SQL databases
What is COALESCE?
COALESCE: A function that returns the first argument that is not NULL, scanning left to right. It is used to substitute a default for missing values before displaying or calculating. It is handy for reports.
COALESCE: an example
COALESCE(discount, 0) treats a missing discount as 0, so price - COALESCE(discount, 0) never becomes NULL.
Related terms
More SQL databases terms
- Column
- COMMIT and ROLLBACK
- Common table expression
- Composite index
- Connection pool
- Correlated subquery
- Covering index
- CROSS JOIN
Where you learn it
COALESCE is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.