Oracle Database SQL — Question 169

The CUSTOMERS table has a CUST_LAST_NAME column of data type VARCHAR2.

The table has two rows whose CUST_LAST_NAME values are Anderson and Ausson.

Which query produces output for CUST_LAST_NAME containing Oder for the first row and Aus for the second?

Answer options

Correct answer: A

Explanation

Option A is correct because it first removes 'son' from the last names and then replaces 'An' with 'O', resulting in 'Oder' for 'Anderson' and 'Aus' for 'Ausson'. Option B will not produce the desired output because TRIM does not have the intended effect on the string. Option C incorrectly uses SUBSTR which does not modify the string as required. Option D has a syntax error in TRIM and does not yield the correct transformations.