Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 503 Bytes

3004.md

File metadata and controls

14 lines (11 loc) · 503 Bytes

String Concatenation

Use COALESCE for string concatenation of nullable columns:

You may need to force a column or expression to be non-null for the sake of simplifying the query logic, but you don't want that value to be stored. Use COALESCE function to construct the concatenated expression so that a null-valued column doesn't make the whole expression become null.

Example

SELECT first_name || COALESCE(' ' || middle_initial || ' ', ' ') || last_name
AS full_name FROM Accounts