COALESCE (Lakehouse v1)
Renvoie la première expression non NULL parmi ses arguments ; si tous les arguments sont NULL, renvoie NULL.
Syntaxe Analyze
Section intitulée « Syntaxe Analyze »func.coalesce(<expr1>[, <expr2> ...])Exemples Analyze
Section intitulée « Exemples Analyze »func.coalesce(table.UOM, 'none', \n)
func.coalesce(get_column(table2, 'TECHNOLOGY_RATE'), 0.0)
func.coalesce(table_beta.adjusted_price, table_alpha.override_price, table_alpha.price) * table_beta.quantity_soldSyntaxe SQL
Section intitulée « Syntaxe SQL »COALESCE(<expr1>[, <expr2> ...])Exemples SQL
Section intitulée « Exemples SQL »SELECT COALESCE(1), COALESCE(1, NULL), COALESCE(NULL, 1, 2);
┌────────────────────────────────────────────────────────┐│ coalesce(1) │ coalesce(1, null) │ coalesce(null, 1, 2) │├─────────────┼───────────────────┼──────────────────────┤│ 1 │ 1 │ 1 │└────────────────────────────────────────────────────────┘
SELECT COALESCE('a'), COALESCE('a', NULL), COALESCE(NULL, 'a', 'b');
┌────────────────────────────────────────────────────────────────┐│ coalesce('a') │ coalesce('a', null) │ coalesce(null, 'a', 'b') │├───────────────┼─────────────────────┼──────────────────────────┤│ a │ a │ a │└────────────────────────────────────────────────────────────────┘