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);

OCP-1Z0-051-V9.02-127题

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);

OCP-1Z0-051-V9.02-127题

C:

select c1.custname,c1.city from customers c1 LEFT join customers c2 

on (c1.city=c2.city and c1.custname<>c2.custname);

OCP-1Z0-051-V9.02-127题

D: 

select c1.custname,c1.city from customers c1 full join customers c2 

  on (c1.city=c2.city and c1.custname<>c2.custname);

OCP-1Z0-051-V9.02-127题

E:
select c1.custname,c1.city from customers c1 RIGHT join customers c2 
  on (c1.city=c2.city and c1.custname<>c2.custname);
OCP-1Z0-051-V9.02-127题

注意:题目限定只显示左边表的要显示的数据。

相关资料可参考:https://blog.csdn.net/qq_36249352/article/details/79654686

相关文章:

  • 2021-05-18
  • 2021-05-20
  • 2022-01-11
  • 2021-07-16
  • 2022-03-07
  • 2022-01-01
  • 2021-09-29
  • 2021-12-30
猜你喜欢
  • 2021-11-01
  • 2021-04-17
  • 2021-08-14
  • 2021-04-22
  • 2021-05-22
  • 2021-10-02
  • 2021-07-14
相关资源
相似解决方案