您的位置:首页 > 大数据 > 人工智能

3.You need to extract details of those products in the SALES table where the PROD_ID column contains

2016-01-17 22:41 831 查看
3.You need to extract details of those products in the SALES table where the PROD_ID column

contains the string '_D123'.

Which WHERE clause could be used in the SELECT statement to get the required output?

A.WHERE prod_id LIKE '%_D123%' ESCAPE '_'

B.WHERE prod_id LIKE '%\_D123%' ESCAPE '\'

C.WHERE prod_id LIKE '%_D123%' ESCAPE '%_'

D.WHERE prod_id LIKE '%\_D123%' ESCAPE '\_'

答案:B

解析:这道题考察的是转意字符,oracle没有默认的转意字符,需要用escape来指定,指定成啥就是啥

并且,它只能是1个长度的字符,这道题问的是你怎么能知道pro_id列中包含_D123的记录,让你确定where条件,由于这里用了要找_,

而_表示的是一个任意字符,所以需要使用转意字符,选B

A.错误,这里相当与指定_为转意字符,对D进行转意了

B.正确

C.错误,escape只能指定长度为1的字符

D.错误,escape只能指定长度为1的字符
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: