Free 1Z0-071 Conditional Expressions Questions and Answers

0%

Which of the following is a valid use of the CASE expression in SQL?

Correct! Wrong!

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.

How would you use the COALESCE function to return the first non-NULL value from a list of columns?

Correct! Wrong!

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;.

Which of the following is true about the DECODE function?

Correct! Wrong!

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.

What will be the output of the following SQL statement?

Correct! Wrong!

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'.

What will the following SQL statement return?

Correct! Wrong!

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'.