COALESCE('placeholder') vs. 'placeholder'
What's the difference between using COALESCE() function instead of just using the literal by itself to output placeholders?
# This simpler one:
SELECT dept_no, dept_name, 'department manager name' AS fake_col FROM departments_dup;
# over COALESCE:
SELECT dept_no, dept_name, COALESCE('department manager name') AS fake_col FROM departments_dup;
1 answers ( 0 marked as helpful)
Hi Duncan!
Thanks for reaching out.
In this particular case there is no difference.
The COALESCE() function returns the first non-null value in a list. It is usually used with columns and checking if the current column is NULL.
Hope this helps.
Best,
Tsvetelin