OCP 1Z0 051 127
来源:互联网 发布:mac版梦幻西游更新失败 编辑:程序博客网 时间:2024/04/20 04:34
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 __________________ 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
NATURAL JOIN 后不能有 on子句
LEFT JOIN 以左表为主,条件c1.custname<>c2.custname起不到过滤作用
同样,这儿FULL JOIN 也没有过滤作用
严格来说,该题中所述语句有问题
我们先新增一条
可以看到数据重复了,应用下面方法查询
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
NATURAL JOIN 后不能有 on子句
SQL> SELECT c1.custname, c1.city 2 FROM test.customers c1 3 NATURAL JOIN test.customers c2 4 ON (c1.city = c2.city AND c1.custname <> c2.custname);SELECT c1.custname, c1.city FROM test.customers c1 NATURAL JOIN test.customers c2 ON (c1.city = c2.city AND c1.custname <> c2.custname)ORA-00933: SQL 命令未正确结束
LEFT JOIN 以左表为主,条件c1.custname<>c2.custname起不到过滤作用
SQL> SELECT c1.custname, c1.city 2 FROM test.customers c1 3 LEFT JOIN test.customers c2 4 ON (c1.city = c2.city AND c1.custname <> c2.custname);CUSTNAME CITY-------- --------KOCHAR SEATTLEKING SEATTLESMITH NEW YORKGREEN BOSTON4 rows selected
同样,这儿FULL JOIN 也没有过滤作用
SQL> SELECT c1.custname, c1.city 2 FROM test.customers c1 3 FULL OUTER JOIN test.customers c2 4 ON (c1.city = c2.city AND c1.custname <> c2.custname);CUSTNAME CITY-------- --------KOCHAR SEATTLEKING SEATTLESMITH NEW YORKGREEN BOSTON6 rows selected
SQL> SELECT c1.custname, c1.city 2 FROM test.customers c1 3 JOIN test.customers c2 4 ON (c1.city = c2.city AND c1.custname <> c2.custname);CUSTNAME CITY-------- --------KOCHAR SEATTLEKING SEATTLE2 rows selected
SQL> SELECT c1.custname, c1.city 2 FROM test.customers c1 3 RIGHT OUTER JOIN test.customers c2 4 ON (c1.city = c2.city AND c1.custname <> c2.custname);CUSTNAME CITY-------- --------KING SEATTLEKOCHAR SEATTLE4 rows selected
严格来说,该题中所述语句有问题
我们先新增一条
SQL> INSERT INTO test.CUSTOMERS 2 (CUSTNO,CUSTNAME,CITY) 3 VALUES(5,'TEST','SEATTLE');1 row insertedExecuted in 0.016 seconds
SQL> SELECT c1.custname, c1.city 2 FROM test.customers c1 3 JOIN test.customers c2 4 ON (c1.city = c2.city AND c1.custname <> c2.custname);CUSTNAME CITY-------- --------TEST SEATTLEKOCHAR SEATTLETEST SEATTLEKING SEATTLEKOCHAR SEATTLEKING SEATTLE6 rows selected
可以看到数据重复了,应用下面方法查询
SQL> SELECT c1.custname, c1.city 2 FROM test.customers c1 3 WHERE EXISTS (SELECT NULL 4 FROM test.customers c2 5 WHERE c1.city = c2.city 6 AND c1.custname <> c2.custname);CUSTNAME CITY-------- --------TEST SEATTLEKOCHAR SEATTLEKING SEATTLE3 rows selected
0 0
- OCP 1Z0 051 127
- OCP 1Z0 052 127
- OCP 1Z0 053 127
- OCP 1Z0 051 1
- OCP 1Z0 051 2
- OCP 1Z0 051 3
- OCP 1Z0 051 4
- OCP 1Z0 051 5
- OCP 1Z0 051 6
- OCP 1Z0 051 7
- OCP 1Z0 051 8
- OCP 1Z0 051 9
- OCP 1Z0 051 10
- OCP 1Z0 051 11
- OCP 1Z0 051 12
- OCP 1Z0 051 13
- OCP 1Z0 051 14
- OCP 1Z0 051 15
- 画一个萝卜吃
- 使用 SPARQL 查询 RDF
- 信息学习13
- cvCopy与cvCloneImage的区别
- C\C++代码优化的27个建议
- OCP 1Z0 051 127
- cc150第一章JAVA字符串和数组总结
- 诸葛蝴蝶
- linux下mysql安装配置
- 数据层反射对象
- 2、Cocos2dx 3.0游戏开发找小三之引擎简介
- 【Java】深入Java多线程和并发编程之ReentrantLock
- SAP培训学校的选择
- 组播地址划分