100.View the Exhibit and examine the structure of the PROMOTIONS table.
来源:互联网 发布:无锡丝密斯 知乎 编辑:程序博客网 时间:2024/05/17 23:11
100.View the Exhibit and examine the structure of the PROMOTIONS table.
Which SQL statements are valid? (Choose all that apply.)
A.SELECT promo_id, DECODE(NVL(promo_cost,0), promo_cost, promo_cost * 0.25, 100) "Discount" FROM promotions;
B.SELECT promo_id, DECODE(promo_cost, 10000, DECODE(promo_category, 'G1', promo_cost *.25, NULL),NULL) "Catcost" FROM promotions;
C.SELECT promo_id, DECODE(NULLIF(promo_cost, 10000), NULL, promo_cost*.25, 'N/A') "Catcost" FROM promotions;
D.SELECT promo_id, DECODE(promo_cost, >10000, 'High',<10000, 'Low') "Range" FROM promotions;
答案:AB
解析:
decode(expr,search,result[,search,result,...,default]),比较expr和search,如果匹配返回result,如果都不匹配返回default
如果没有default那么返回null,oracle会将expr和匹配到的search,或者default自动转换为第一个result的类型,如果第一个result为char类型,那么返回varchar2类型
A:正确
B:正确
C:错误,如果NULLIF(promo_cost, 10000)返回不是null,那么最后结果应该是'N/A',他应该转换为第一个result,也就是promo_cost*.25,转换失败
D:错误,decode 里面 >100这个错误
Which SQL statements are valid? (Choose all that apply.)
A.SELECT promo_id, DECODE(NVL(promo_cost,0), promo_cost, promo_cost * 0.25, 100) "Discount" FROM promotions;
B.SELECT promo_id, DECODE(promo_cost, 10000, DECODE(promo_category, 'G1', promo_cost *.25, NULL),NULL) "Catcost" FROM promotions;
C.SELECT promo_id, DECODE(NULLIF(promo_cost, 10000), NULL, promo_cost*.25, 'N/A') "Catcost" FROM promotions;
D.SELECT promo_id, DECODE(promo_cost, >10000, 'High',<10000, 'Low') "Range" FROM promotions;
答案:AB
解析:
decode(expr,search,result[,search,result,...,default]),比较expr和search,如果匹配返回result,如果都不匹配返回default
如果没有default那么返回null,oracle会将expr和匹配到的search,或者default自动转换为第一个result的类型,如果第一个result为char类型,那么返回varchar2类型
A:正确
B:正确
C:错误,如果NULLIF(promo_cost, 10000)返回不是null,那么最后结果应该是'N/A',他应该转换为第一个result,也就是promo_cost*.25,转换失败
D:错误,decode 里面 >100这个错误
0 0
- 100.View the Exhibit and examine the structure of the PROMOTIONS table.
- 56.View the Exhibit and examine the structure of the PROMOTIONS table.
- 61.View the Exhibit and examine the structure of the PROMOTIONS table.
- 99.View the Exhibit and examine the structure of the PROMOTIONS table.
- 112.View the Exhibit and examine the structure of the PROMOTIONS table.
- 118.View the Exhibit and examine the structure of the PROMOTIONS table.
- 143.View the Exhibit and examine the structure of the PROMOTIONS table.
- 147.View the Exhibit and examine the structure of the PROMOTIONS table.
- 91.View the Exhibit and examine the structure of the PROMOTIONS table. Which two SQL statements woul
- 10.View the Exhibit;examine the structure of the PROMOTIONS table.
- 124.View the Exhibit and examine the structure of the PROMOTIONS, SALES, and CUSTOMER tables.
- 8.View the Exhibit and examine the structure of the CUSTOMERS table.
- 11.View the Exhibit and examine the structure of the PRODUCTS table.
- 13.View the Exhibit and examine the structure of the PRODUCTS table.
- 44.View the Exhibit and examine the structure of the ORD table.
- 52.View the Exhibit and examine the structure of the PRODUCTS table.
- 54.View the Exhibit and examine the structure of the CUSTOMERS table.
- 63.View the Exhibit and examine the structure of the PRODUCTS table.
- Android数据存储实现的5大方式
- 文章标题
- Matlab GUI通用函数get和set
- Aoj 0033 Ball【dfs枚举】
- c++STL(一)重载与模板。
- 100.View the Exhibit and examine the structure of the PROMOTIONS table.
- centos添加自定义程序到service
- Javase02标识符,关键字和基本数据类型
- js 时间格式
- Android EditText setOnClickListener事件 只有获取焦点才能响应 采用setOnTouchListener解决
- 【MySQL新手必看】百宝云的MySQL数据库基础知识
- 算法1:1020. Big Integer
- gerrit reindex
- Lua中的面向对象[2]:使用指针