zoukankan      html  css  js  c++  java
  • 【OCP 12c】最新CUUG OCP-071考试题库(61题)

    61、(18-6) choose the best answer:

    View the Exhibit and examine the structure of the CUSTOMERS table.

    You want to generate a report showing the last names and credit limits of all customers whose last names start with A, B, or C, and credit limit is below 10,000.

    Evaluate the following two queries:

    SQL> SELECT cust_last_name, cust_credit_limit FROM customers

    WHERE (UPPER(cust_last_name) LIKE 'A%' OR

    UPPER(cust_last_name) LIKE 'B%' OR

    UPPER(cust_last_name) LIKE 'C%')

    AND cust_credit_limit < 10000;

    SQL> SELECT cust_last_name, cust_credit_limit FROM customers

    WHERE UPPER(cust_last_name) BETWEEN 'A' AND 'C'

    AND cust_credit_limit < 10000;

    Which statement is true regarding the execution of the above queries?

    A) Only the second query gives the correct result.

    B) Only the first query gives the correct result.

    C) Both execute successfully but do not give the required result.

    D) Both execute successfully and give the same result.

    Answer:B

    (解析:验证结果发现第二 sql 语句不能返回 C 开头的名字,如果改为 BETWEEN 'A' AND 'D',则查出来的结果与第一个语句一样,而且语句简洁,答案更好。

    经过测试发现,如果数据类型是 number 的,则 between 800 and 3000 的结果包含 3000 的值:

    SQL> select sal from emp where sal between 800 and 3000;

    SAL

    ---------

    800

    1600)

    1500

    950

    3000

    但是如果是字符型的,则不包含between 'A' AND 'C'后面的 C :

    SQL> select ename from emp where ename between 'A' AND 'C';

    ENAME

    ----------

    ALLEN

    BLAKE

    )

  • 相关阅读:
    前端-【学习心得】-事件委托方法
    [方法] iOS时间戳的转换
    [封装] 修改NSString中部分字段的颜色
    Python3基础16——file对象测试数据的读写与操作
    Python3基础15—— 变量作用域
    Python3基础14——函数&内置函数
    Python3基础13——冒泡排序
    Python3基础12——while循环
    Python3基础11——打印三角形
    Python3基础10——切片(str和list)
  • 原文地址:https://www.cnblogs.com/cnblogs5359/p/10481503.html
Copyright © 2011-2022 走看看