Chinaunix首页 | 论坛 | 博客
  • 博客访问: 604375
  • 博文数量: 487
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 4916
  • 用 户 组: 普通用户
  • 注册时间: 2018-07-05 13:59
个人简介

ocp考试资料群:569933648 验证码:ocp OCP 12c 19c考试题库解析与资料群:钉钉群号:35277291

文章分类

全部博文(487)

文章存档

2023年(37)

2021年(151)

2020年(37)

2019年(222)

2018年(38)

我的朋友

分类: Oracle

2019-02-28 10:14:47

46、(10-4) choose two:

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?

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)- INSTR(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),'*') "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;

Answer:AC

(解析:题意是:您希望只提取具有三个名称的那些客户名称,并显示*符号来代替名称如下注意条件的用法 INSTR(cust_name, ' ',1,2)<>00,意思是从名字中找空格,从第一个开始,查看第二个空格的位置,如果有,说明名字里面就有三个名称,否则只有两个名称。同时INSTR(cust_name, ' ',-1,-2),从倒数第一个空格开始,不能再用-2 了,要用正数)

阅读(1510) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~