ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 047-083

047-083

原创 Linux操作系统 作者:jbymy2000 时间:2012-03-18 10:36:41 0 删除 编辑
83. View the Exhibit and examine the structure of the ORDERS table.
You have to display ORDER_ID, ORDER_DATE, and CUSTOMER_ID for all those
orders that were placed after the last order placed by the customer whose
CUSTOMER_ID is 101.Which query would give you the desired output?
A. SELECT order_id, order_date FROM orders
WHERE order_date > ALL (SELECT MAX(order_date)
FROM orders ) AND
customer_id = 101;
B. SELECT order_id, order_date FROM orders
WHERE order_date > ANY (SELECT order_date
FROM orders WHERE customer_id = 101);
C. SELECT order_id, order_date FROM orders
WHERE order_date > ALL (SELECT order_date
FROM orders WHERE customer_id = 101);
D. SELECT order_id, order_date FROM orders
WHERE order_date IN (SELECT order_date
FROM orders
WHERE customer_id = 101);
Answer: C
题目: the last order placed 可理解为日期最大的,所以用>ALL
Some在此表示满足其中一个的意义,是用or串起来的比较从句。
Any也表示满足其中一个的意义,也是用or串起来的比较从句,区别是any一般用在
非“=”的比较关系中,这也很好理解,英文中的否定句中使用any肯定句中使用
sone,这一点是一样的。
All则表示满足其其中所有的查询结果的含义,使用and串起来的比较从句。
1:select ename,sal From emp
Where sal > any(select sal from emp where deptno = 10);
只要比部门号为10的员工中的那个工资最少的员工的工资高就满足条件
2:select ename,sal
From emp Where sal > all(select sal from emp where deptno = 20);
找到比部门号为20的员工的所有员工的工资都要高的员工,也就是比那个工资最高
的员工的还要高的员工

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11312660/viewspace-718858/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 047-081
下一篇: 047-088
请登录后发表评论 登录
全部评论

注册时间:2012-01-10

  • 博文量
    416
  • 访问量
    203398