The correct syntax for a CASE expression is CASE WHEN condition THEN result ELSE result END. This allows you to evaluate conditions and return specific values based on the outcome.
The COALESCE function returns the first non-NULL value from a list of columns. The correct syntax is SELECT COALESCE(column1, column2, column3) FROM table_name;.
The DECODE function compares an expression to a list of values and returns the corresponding result. It can handle various data types and is often used to simplify complex CASE expressions.
The CASE expression evaluates each condition in order. If an employee's salary is greater than 10000, they get a grade 'A'; if it's between 5001 and 10000, they get a grade 'B'; otherwise, they get a grade 'C'.
The DECODE function compares the department_id with the specified values. If department_id is 10, it returns 'Administration'; if it's 20, it returns 'Marketing'; otherwise, it returns 'Other'.