一、原题
EMPNO ENAME
---------- ----------
7876 ADAMS
7499 ALLEN
7698 BLAKE
7782 CLARK
7902 FORD
7900 JAMES
7566 JONES
7839 KING
7654 MARTIN
7934 MILLER
7788 SCOTT
7369 SMITH
7844 TURNER
7521 WARD
已选择14行。
SQL> select empno,ename from emp
2 where ename between 'A' and 'C';
EMPNO ENAME
---------- ----------
7876 ADAMS
7499 ALLEN
7698 BLAKE
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 first query gives the correct result.
B. Only the second query gives the correct result
C. Both execute successfully and give the same result.
D. Both execute successfully but do not give the required result.
答案:A
二、题目翻译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 first query gives the correct result.
B. Only the second query gives the correct result
C. Both execute successfully and give the same result.
D. Both execute successfully but do not give the required result.
答案:A
查看CUSTOMERS表的结构
现在要生成一个报表,显示所有customers的last names和credit limits,客户的last names以A, B, 或C开头,并且credit limit小于10,000
下面的两个查询:
关于上面的查询哪个描述是正确的?
A.只有第一个查询给出正确结果。
B.只有第二个查询给出正确结果。
C.两个都能执行成功,并给出正确结果。
D.两个都能执行成功,但不能给出所需结果。
三、题目解析现在要生成一个报表,显示所有customers的last names和credit limits,客户的last names以A, B, 或C开头,并且credit limit小于10,000
下面的两个查询:
关于上面的查询哪个描述是正确的?
A.只有第一个查询给出正确结果。
B.只有第二个查询给出正确结果。
C.两个都能执行成功,并给出正确结果。
D.两个都能执行成功,但不能给出所需结果。
因为第二条查询语句里的BETWEEN 'A' AND 'C',只能查出以A和B开头的,不能查出以C开头的。
具体测试如下,只出现A和B开头的,并没有出现C开头的:
SQL> select empno,ename from emp order by ename;
EMPNO ENAME
---------- ----------
7876 ADAMS
7499 ALLEN
7698 BLAKE
7782 CLARK
7902 FORD
7900 JAMES
7566 JONES
7839 KING
7654 MARTIN
7934 MILLER
7788 SCOTT
7369 SMITH
7844 TURNER
7521 WARD
已选择14行。
SQL> select empno,ename from emp
2 where ename between 'A' and 'C';
EMPNO ENAME
---------- ----------
7876 ADAMS
7499 ALLEN
7698 BLAKE