Complete the code to return the first non-null value between column1 and column2.
SELECT COALESCE(column1, [1]) AS result FROM table_name;The COALESCE function returns the first non-null value from the list. Here, it checks column1 first, then column2.
Complete the code to return NULL if column1 equals column2, otherwise return column1.
SELECT NULLIF(column1, [1]) AS result FROM table_name;NULLIF returns NULL if the two arguments are equal. Here, it compares column1 and column2.
Fix the error in the code to return the first non-null value among column1, column2, and 'N/A'.
SELECT COALESCE([1], column2, 'N/A') AS result FROM table_name;
The first argument to COALESCE should be column1 to check it first for a non-null value.
Fill both blanks to return 'Unknown' if column1 equals column2, else return column1 or 'Unknown' if column1 is NULL.
SELECT COALESCE(NULLIF(column1, [1]), [2]) AS result FROM table_name;
NULLIF(column1, column2) returns NULL if equal, then COALESCE returns 'Unknown' if NULL, else column1.
Fill all three blanks to return the uppercase of column1 if UPPER(column1) is not equal to column2 and column1 is not NULL, else return 'DEFAULT'.
SELECT COALESCE(NULLIF([1], [2]), [3]) AS result FROM table_name;
NULLIF compares UPPER(column1) and column2; if equal returns NULL, then COALESCE returns 'DEFAULT' if NULL.