127.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 left join Customers c2
ON (c1.city=c2.city AND c1.custname<>c2.custname);
select * from CUSTOMERS
delete CUSTOMERS where custno<4
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
答案:A
解析:这里说的是找出,同一个城市的不同的消费者,这里肯定是使用join
A:正确
B:错误,有前缀和on条件,可以排除了
C:错误,这里使用了left join,他是把符合条件的,和没有符合条件的都会列出来,因此有问题
D:错误,同上
E:错误,同上
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 left join Customers c2
ON (c1.city=c2.city AND c1.custname<>c2.custname);
select * from CUSTOMERS
delete CUSTOMERS where custno<4
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
答案:A
解析:这里说的是找出,同一个城市的不同的消费者,这里肯定是使用join
A:正确
B:错误,有前缀和on条件,可以排除了
C:错误,这里使用了left join,他是把符合条件的,和没有符合条件的都会列出来,因此有问题
D:错误,同上
E:错误,同上