- 最后登录
- 2016-12-8
- 在线时间
- 18 小时
- 威望
- 0
- 金钱
- 179
- 注册时间
- 2016-10-10
- 阅读权限
- 10
- 帖子
- 156
- 精华
- 0
- 积分
- 0
- UID
- 2486
|
79#
发表于 2016-11-18 13:53:50
83. Examine the data in the CUST_NAME column of the CUSTOMERS table.(查看表数据)
CUST_NAME
Lex De Haan
Renske Ladwig
Jose Manuel Urman
Jason Mallin
You want to extract only those customer names that have three names and display the * symbol in place of the first name as follows:
(你只想提取那些有三个名字的客户,第一个名字用*号替换)
CUST NAME
*** De Haan
**** Manuel Urman
Which two queries give the required output? (Choose two.)
A. SELECT LPAD(SUBSTR(cust_name,INSTR(cust_name,' ')),LENGTH(cust_name),'*') "CUST NAME"
FROM customers
WHERE INSTR(cust_name, ' ',1,2)<>0;
B. SELECT LPAD(SUBSTR(cust_name,INSTR(cust_name,' ')),LENGTH(cust_name),'*') "CUST NAME"
FROM customers
WHERE INSTR(cust_name, ' ',-1,2)<>0;
C.SELECT LPAD(SUBSTR(cust_name,INSTR(cust_name,' ')),LENGTH(cust_name)-
INSTR(cust_name,' '),'*') "CUST NAME"
FROM customers
WHERE INSTR(cust_name, ' ',-1,-2)<>0;
D.SELECT LPAD(SUBSTR(cust_name,INSTR(cust_name,' ')),LENGTH(cust_name)- INSTR(cust_name,' '),'*') "CUST NAME"
FROM customers
WHERE INSTR(cust_name, ' ',1,2)<>0;
答案:AB
instr如果第3个参数为负数,则从右边开始查找,但是返回的值是从左边开始计算的
例如:select instr(‘ababab’,’a’,-1,3) from dual;返回的值是1,即从右边第1个字符开始查找,第3次出现a的位置是从左边数第1个
|
|