Which four statements correctly describe functions that are available in SQL? (Choose four.)

  1. INSTR returns the numeric position of a named character.

  2. NVL2 returns the first non-null expression in the expression list.

  3. TRUNCATE rounds the column, expression, or value to n decimal places.

  4. DECODE translates an expression after comparing it to each search value.

  5. TRIM trims the heading or trailing characters (or both) from a character string.

  6. NULLIF compares two expressions and returns null if they are equal, or the first expression if they are not equal.


Correct Option: A,D,E,F

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) INSTR returns the numeric position of a named character. - This option is correct. The INSTR function in SQL returns the position of a specified character or substring within a string.

Option B) NVL2 returns the first non-null expression in the expression list. - This option is incorrect. The NVL2 function in SQL returns the second expression if the first expression is not null, otherwise, it returns the third expression.

Option C) TRUNCATE rounds the column, expression, or value to n decimal places. - This option is incorrect. The TRUNCATE function in SQL is used to remove all rows from a table or a partition, not to round values.

Option D) DECODE translates an expression after comparing it to each search value. - This option is correct. The DECODE function in SQL compares an expression to each search value and returns a result based on the match.

Option E) TRIM trims the heading or trailing characters (or both) from a character string. - This option is correct. The TRIM function in SQL removes leading and trailing characters (or both) from a character string.

Option F) NULLIF compares two expressions and returns null if they are equal, or the first expression if they are not equal. - This option is correct. The NULLIF function in SQL compares two expressions and returns null if they are equal, or the first expression if they are not equal.

The four correct statements are A) INSTR, D) DECODE, E) TRIM, and F) NULLIF.

Find more quizzes: