## Syntax ```mermaid %%{init: { 'theme': 'base', 'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' }, 'themeVariables': { 'fontSize': '11px', 'fontFamily': 'Arial' } }}%% flowchart LR Start((START)) --> COALESCE[COALESCE]:::quoted COALESCE --> End((END)) ``` ## Purpose The `COALESCE` SQL function performs a coalescing operation, returning the first non-`null` value and `null` otherwise. Parameters: - Position 1: a value. - Position n: more values. Returns: the first non-`null` value. ## Examples The following example retrieves the first non-`null`: ```sql select coalesce(-5, null, -3) -------- -5 ``` The following example retrieves the first non-`null`: ```sql select coalesce(null, null, -5, -3) -------- -5 ``` The following example retrieves the first non-`null`. Please note that the empty text has `null` semantics on Invantive UniversalSQL: ```sql select coalesce(null, '', 'answer 1', 'answer 2') -------- answer 1 ```