Which query gives the required output?

Examine the data in the CUST_NAME column of the CUSTOMERS table.
CUST_NAME
Renske Ladwig
Jason Mallin
Samuel McCain
Allan MCEwen
Irene Mikkilineni
Julia Nayer
You need to display customers’ second names where the second name starts with "Mc" or "MC."
Which query gives the required output?

Examine the data in the CUST_NAME column of the CUSTOMERS table.
CUST_NAME
Renske Ladwig
Jason Mallin
Samuel McCain
Allan MCEwen
Irene Mikkilineni
Julia Nayer
You need to display customers’ second names where the second name starts with "Mc" or "MC."
Which query gives the required output?

A.
SELECT SUBSTR(cust_name, INSTR(cust_name,’ ‘)+1)
FROM customers
WHERE INITCAP(SUBSTR(cust_name, INSTR(cust_name,’ ‘)+1))=’Mc’;

B.
SELECT SUBSTR(cust_name, INSTR(cust_name,’ ‘)+1)
FROM customers
WHERE INITCAP(SUBSTR(cust_name, INSTR(cust_name,’ ‘)+1)) LIKE ‘Mc%’;

C.
SELECT SUBSTR(cust_name, INSTR(cust_name,’ ‘)+1)
FROM customers
WHERE SUBSTR(cust_name, INSTR(cust_name,’ ‘)+1) LIKE INITCAP(‘MC%’);

D.
SELECT SUBSTR(cust_name, INSTR(cust_name,’ ‘)+1)
FROM customers
WHERE INITCAP(SUBSTR(cust_name, INSTR(cust_name,’ ‘)+1)) = INITCAP(‘MC%’);



Leave a Reply 11

Your email address will not be published. Required fields are marked *


KHOA

KHOA

I think C is right.

Morven

Morven

No, it’s not. It returns only McCain.

Giri

Giri

s i agree with morven it returns only McCain so B is only correct.

sky

sky

B is not correct, INITCAP also return mcChain as a result, which is not correct.

C is correct for one answer which starts with MC%

Ritam Tiwari

Ritam Tiwari

SELECT SUBSTR(cust_name, INSTR(cust_name,’ ‘)+1)
FROM customers
WHERE INITCAP(SUBSTR(cust_name, INSTR(cust_name,’ ‘)+1)) LIKE ‘Mc%’;

how this would give “MCEwen” ??????? because Mc should be there in the starting..

kindly explain

admin

admin

Please stop this discussion. It is cheating and violation of Oracle’s examination policy.

admin

admin

Please see in the B option that “INITCAP” is also used…hope u got it

sky

sky

INITCAP will also return, if 2nd name start with small mc like mcChain, that will convert it McChain which is not correct .

B is not coreect

srini

srini

Thank you soooooooo much Bro For all the stuff ,you uploaded.