127. Examine the data in the CUSTOMERS table:
CUSTNO CUSTNAME CITY
1 KING SEATTLE
2 GREEN BOSTON
3 KOCHAR SEATTLE
4 SMITH NEWYORK
You want to list allcities that have more than one customer along with thecustomer details.
Evaluate the following query:
SQL>SELECT c1.custname, c1.city
FROM Customers c1 __________________Customers c2
ON (c1.city=c2.city ANDc1.custname<>c2.custname);
Which two JOIN options can be used inthe 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
Answer: AE
答案解析:
A:
select c1.custname,c1.city from customers c1 join customers c2
on (c1.city=c2.city and c1.custname<>c2.custname);B:select列表中c1.city有限定,自然连接不需要关联条件
select c1.custname,c1.city from customers c1 natural join customers c2
on (c1.city=c2.city and c1.custname<>c2.custname);
C:
select c1.custname,c1.city from customers c1 LEFT join customers c2
on (c1.city=c2.city and c1.custname<>c2.custname);D:
select c1.custname,c1.city from customers c1 full join customers c2
on (c1.city=c2.city and c1.custname<>c2.custname);on (c1.city=c2.city and c1.custname<>c2.custname);
注意:题目限定只显示左边表的要显示的数据。
相关资料可参考:https://blog.csdn.net/qq_36249352/article/details/79654686