zoukankan      html  css  js  c++  java
  • OCP-1Z0-051-V9.02-11题

    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
    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?
     
    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.
     
    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
  • 相关阅读:
    排序之选择排序
    排序之冒泡排序
    NOIP 模拟 $22; m d$
    NOIP 模拟 $20; m z$
    NOIP 模拟 $20; m y$
    NOIP 模拟 $20; m 玩具$
    NOIP 模拟 $21; m Median$
    NOIP 模拟 $21; m Park$
    NOIP 模拟 $21; m Game$
    NOIP 模拟 $19; m w$
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13317265.html
Copyright © 2011-2022 走看看