Choone three
Examine the description of the PRODUCTS table:
Name Null? Type
PRODUCT_ID NOT NULL NUMBER(2)
PRODUCT_NANE VARCHAR2(10)
UNIT_PRICE NUMBER(3)
PURCHARGE VARCHAR2(2)
EXPIRY_DATE DATE
DELIVERY_DATE DATE
Which three queres use valid expressions?
A) SELECT produet_id, unit_pricer, 5 "Discount",unit_price+purcharge-discount FROM products;
B) SELECT product_id, (unit_price * 0.15 / (4.75 + 552.25)) FROM products;
C) SELECT ptoduct_id, (expiry_date - delivery_date) * 2 FROM products;
D) SPLECT product_id, expiry_date * 2 FROM products;
E) SELEGT product_id, unit_price, unit_price + Purcharge FROM products;
F) SELECT product_id,unit_price || "Discount" , unit_price + surcharge - discount FROM products;
Answer:BCE
(解析:如果字符型的存储的是数字,那么查询的时候 oracle 会自动转化,否则会转化失败;
A 的 Answer:5 "Discount"就是添加一个新列,值为 5,但是虚拟的列不能放在数学表达式中。
Answer:F 中不能是双引号,字符串要用单引号,别名用双引号。)
原文地址:https://blog.51cto.com/13854012/2445396