11. View the Exhibit and examine the structure of the PRODUCTS table.
All products have a list price.
You issue the following command to display the total price of each product after a discount of 25% and a
All products have a list price.
You issue the following command to display the total price of each product after a discount of 25% and a
tax of 15% are applied on it. Freight charges of $100 have to be applied to all the products.
SQL>SELECT prod_name, prod_list_price -(prod_list_price*(25/100))
+(prod_list_price -(prod_list_price*(25/100))*(15/100))+100
AS "TOTAL PRICE"
FROM products;
What would be the outcome if all the parenthese s are removed from the above statement?
SQL>SELECT prod_name, prod_list_price -(prod_list_price*(25/100))
+(prod_list_price -(prod_list_price*(25/100))*(15/100))+100
AS "TOTAL PRICE"
FROM products;
What would be the outcome if all the parenthese s are removed from the above statement?
A. It produces a syntax error.
B. The result remains unchanged.
C. The total price value would be lower than the correct value.
D. The total price value would be higher than the correct value.
B. The result remains unchanged.
C. The total price value would be lower than the correct value.
D. The total price value would be higher than the correct value.
sh@TESTDB> SELECT prod_name, prod_list_price -(prod_list_price*(25/100))
2 +(prod_list_price -(prod_list_price*(25/100))*(15/100))+100
3 AS "TOTAL PRICE"
4 FROM products where rownum<6
5 order by "TOTAL PRICE";
PROD_NAME TOTAL PRICE
-------------------------------------------------- -----------
Y Box 613.732875
5MP Telephoto Digital Camera 1641.23288
17" LCD w/built-in HDTV Tuner 1812.48288
Envoy 256MB - 40GB 1812.48288
Mini DV Camcorder with 3.5" Swivel LCD 1983.73288
去除括号后:
sh@TESTDB> SELECT prod_name, prod_list_price -prod_list_price*25/100
2 +prod_list_price -prod_list_price*25/100*15/100+100
3 AS "TOTAL PRICE"
4 FROM products where rownum<6
5 order by "TOTAL PRICE";
PROD_NAME TOTAL PRICE
-------------------------------------------------- -----------
Y Box 613.732875
5MP Telephoto Digital Camera 1641.23288
17" LCD w/built-in HDTV Tuner 1812.48288
Envoy 256MB - 40GB 1812.48288
Mini DV Camcorder with 3.5" Swivel LCD 1983.73288
虽然计算顺序不一样,但计算结果是一样的
此题答案选:B