The COALESCE() function returns the first non-null value in a list. SELECT COALESCE(NULL, 1, 2, 'test'); return => 1