OCP 1Z0 051 59

59. View the Exhibit and examine the data in the PRODUCTS table. 
You  need  to  display  product  names  from  the  PRODUCTS  table  that  belong  to  the  'Software/Other  ' 
category   with minimum prices as either $2000   or $4000   and no unit of measure. 
You issue the following query: 
SQL>SELECT prod_name, prod_category, prod_min_price     
FROM products     
WHERE prod_category LIKE '%Other%' AND (prod_min_price = 2000 OR                
prod_min_price = 4000) AND prod_unit_of_measure <> ''; 
Which statement is true regarding the above query?  


A. It executes successfully but returns no result. 
B. It executes successfully and returns the required result. 
C. It generates an error because the condition specified for PROD_UNIT_OF_MEASURE is not valid. 
D. It generates an error because the condition specified for the   PROD_CATEGORY column is not valid. 

当前,在oracle中,没有空字符串,''就是null。 在这儿 <> '',就是<> null。
判断是否为空,应使用is not null与is null。而与空值比较 <> null这种,结果也为空,所以不返回值。
TEST >SELECT prod_name, prod_category, prod_min_price
  2    FROM sh.products
  3   WHERE prod_category LIKE '%Other%'
  4     AND (prod_min_price = 199.99 OR prod_min_price = 44.99)
  5     AND prod_unit_of_measure IS NOT NULL
  6     AND rownum <= 1;

PROD_NAME                                          PROD_CATEGORY                                      PROD_MIN_PRICE
-------------------------------------------------- -------------------------------------------------- --------------
Unix/Windows 1-user pack                           Software/Other                                          199.99

已选择 1 行。

已用时间:  00: 00: 00.00
TEST >SELECT prod_name, prod_category, prod_min_price
  2    FROM sh.products
  3   WHERE prod_category LIKE '%Other%'
  4     AND (prod_min_price = 199.99 OR prod_min_price = 44.99)
  5     AND prod_unit_of_measure <> '';

未选定行

已用时间:  00: 00: 00.00
TEST >


Answer: A 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值