码迷,mamicode.com
首页 > 其他好文 > 详细

051-127

时间:2017-11-29 19:56:33      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:span   hat   custom   more   output   options   from   sql   new   

Examine the data in the CUSTOMERS table:
                  CUSTNO CUSTNAME CITY

1 KING SEATTLE
2 GREEN BOSTON
3 KOCHAR SEATTLE
4 SMITH NEW YORK


You want to list all cities that have more than one customer along with the customer details.
Evaluate the following query:
SQL>SELECT c1.custname, c1.city
FROM Customers c1 __________________ Customers c2
ON (c1.city=c2.city AND c1.custname<>c2.custname);
Which two JOIN options can be used in the blank in the above query to give the correct output? (Choose
two.)
A. JOIN
B. NATURAL JOIN
C. LEFT OUTER JOIN
D. FULL OUTER JOIN
E. RIGHT OUTER JOIN

  这里解释一下E答案,由于是右外连接,显示 C2 表所有的数据,并且显示 C1 表满足条件的数据,因为 SELECT 语句的列表中没有 C2的列,所以这里只显示了 C1 的两个满足条件的记录加两条空记录。感觉又是一个擦边球。  

051-127

标签:span   hat   custom   more   output   options   from   sql   new   

原文地址:http://www.cnblogs.com/Babylon/p/7922069.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!