Exam 1z0-071 All QuestionsBrowse all questions from this exam
Question 171

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?

    Correct Answer: A

    In the CUSTOMERS table, the requirement is to transform the CUST_LAST_NAME values 'Anderson' to 'Oder' and 'Ausson' to 'Aus'. The query provided must: 1) Remove the substring 'son' from both 'Anderson' and 'Ausson'. 2) Replace 'An' in the remaining string of 'Anderson' with 'O'. Option A uses nested REPLACE functions to achieve this. First, it removes 'son' from each CUST_LAST_NAME, resulting in 'Ander' and 'Aus'. Then, it replaces 'An' with 'O', resulting in 'Oder' and leaving 'Aus' unchanged. Therefore, the correct answer is A.

Discussion
NICK9525Option: A

create table customers (cust_last_name varchar2(10)) select * from customers; insert into customers values ('Anderson') insert into customers values('Ausson') select replace (replace(cust_last_name,'son',''),'An','O') from customers; -- + select replace (trim(trailing 'son' from cust_last_name),'An','O') from customers; -- trim should have only one character select replace (substr (cust_last_name,-3),'An','O') from customers; -- both values are 'son' select initcap(replace(trim('son' from cust_last_name),'An','O')) from customers; -- trim should have only one character

lucemqyOption: A

A is the answer

Raghu06raj2023Option: A

A is the answer