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

    142. View the Exhibit and examine the structure of the PRODUCTS table.

    Evaluate the following query:

    SQL> SELECT prod_name

    FROM products

    WHERE prod_id IN (SELECT prod_id FROM products                   

    WHERE prod_list_price =                         

    (SELECT MAX(prod_list_price)FROM products                          

    WHERE prod_list_price <                               

    (SELECT MAX(prod_list_price)FROM products)));

    What would be the outcome of executing the above SQL statement? 

    A. It produces an error.

    B. It shows the names of all products in the table.

    C. It shows the names of products whose list price is the second highest in the table.

    D. It shows the names of all  products whose list price is less than the maximum list price.

    Answer: C

     

    答案解析:

    1、首先来运行一下上面的sql语句,是可以出结果的。

    sh@TESTDB> SELECT prod_name FROM products
      2  WHERE prod_id IN (SELECT prod_id FROM products
      3  WHERE prod_list_price =
      4  (SELECT MAX(prod_list_price)FROM products
      5  WHERE prod_list_price <
      6  (SELECT MAX(prod_list_price)FROM products)));
    PROD_NAME
    --------------------------------------------------
    Mini DV Camcorder with 3.5" Swivel LCD
    2、拆分上面sql语句,首先运行子句查询出价格最高的产品的价格
    sh@TESTDB> SELECT MAX(prod_list_price)FROM products;
    MAX(PROD_LIST_PRICE)
    --------------------
                 1299.99
    3、低于价格最高的,即价格次高的产品。按题意,故选C.
    sh@TESTDB> SELECT MAX(prod_list_price)FROM products
      2  WHERE prod_list_price < 1299.99;
    MAX(PROD_LIST_PRICE)
    --------------------
                 1099.99
  • 相关阅读:
    Exception: Failed to execute 'setItem' on 'Storage'
    element ui中动态添加的表单进行验证
    10. 自定义assertThat中的Matcher函数lt、gt
    8. anyInt()、anyString()、eq()、anyCollection()、verify验证void方法
    7. 参数匹配:eq、isA、any
    6. spy
    4-5. when-thenXX、doXX-when、Answer、thenCallRealMethod
    2. 开启Mock的三种方式、深度Mook
    1. quickstart
    Sentinel
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13317219.html
Copyright © 2011-2022 走看看