OCP 11g考试题库详解:1Z0-051-082题
最新学讯:近期OCP认证正在报名中,因考试人员较多请尽快报名获取最近考试时间,报名费用请联系在线老师,甲骨文官方认证,报名从速!
我要咨询OCP 11g考试题库详解:1Z0-051-082题,完整题库请点击这里联系老师咨询了解
82. 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%');
Answer: B
试题解析:
题意要求:You need to display customers' second names where the second name starts with "Mc" or "MC."
cust_name由first name和second name组成,中间有空格,要求找出second name以"Mc" or "MC."开头
INSTR(cust_name,' ')找出空格的位置,并返回,这个位置之后的second name的开始。
SUBSTR(cust_name, INSTR(cust_name,' ')+1)找出空格+1的之后的字符,即是找出second name的名字。
INITCAP(SUBSTR(cust_name, INSTR(cust_name,' ')+1)) LIKE 'Mc%' 匹配出 LIKE 'Mc%'or "MC“的字符,使用INITCAP,让其匹配。
故答案选B