OCP-1Z0-051 第120题 NATURAL JOIN自然连接
来源:互联网 发布:arcgis js 事件关闭 编辑:程序博客网 时间:2024/05/16 08:19
一、原题
二、题目翻译
三、题目解析
View the Exhibits and examine the structures of the PRODUCTS, SALES, and CUSTOMERS tables.
You issue the following query:
SQL>SELECT p.prod_id,prod_name,prod_list_price, quantity_sold,cust_last_name
FROM products p NATURAL JOIN sales s NATURAL JOIN customers c
WHERE prod_id =148;
Which statement is true regarding the outcome of this query?
A. It executes successfully.
B. It produces an error because the NATURAL join can be used only with two tables.
C. It produces an error because a column used in the NATURAL join cannot have a qualifier.
D. It produces an error because all columns used in the NATURAL join should have a qualifier.
答案:C
SQL>SELECT p.prod_id,prod_name,prod_list_price, quantity_sold,cust_last_name
FROM products p NATURAL JOIN sales s NATURAL JOIN customers c
WHERE prod_id =148;
Which statement is true regarding the outcome of this query?
A. It executes successfully.
B. It produces an error because the NATURAL join can be used only with two tables.
C. It produces an error because a column used in the NATURAL join cannot have a qualifier.
D. It produces an error because all columns used in the NATURAL join should have a qualifier.
答案:C
二、题目翻译
查看PRODUCTS, SALES, and CUSTOMERS表的结构
执行下面的语句
关于上面语句的执行结果,下面哪句描述是正确的?
A.执行成功。
B.报错,因为NATURAL连接只能连接两个表。
C.报错,因为NATURAL连接使用的一个列不能有限定词。
D.报错,因为NATURAL连接使用的所有列应该加一个限定词。
执行下面的语句
关于上面语句的执行结果,下面哪句描述是正确的?
A.执行成功。
B.报错,因为NATURAL连接只能连接两个表。
C.报错,因为NATURAL连接使用的一个列不能有限定词。
D.报错,因为NATURAL连接使用的所有列应该加一个限定词。
三、题目解析
因为prod_id是用于NATURAL连接,不能加限定词(即两个表中如果有相同列名的都不能加限定词,即列名前不能带表名)。而对于ORACLE自己语法的join是需要对两个表中相同的列使用限定词的。
联机文档上有详细的描述:
http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_10002.htm#BABBAGAH
The NATURAL keyword indicates that a natural join is being performed. A natural join is based on all columns in the two tables that have the same name. It selects rows from the two tables that have equal values in the relevant columns. If two columns with the same name do not have compatible data types, then an error is raised. When specifying columns that are involved in the natural join, do not qualify the column name with a table name or table alias.
自然连接的详细用法,详见:
http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_10002.htm#BABBAGAH
The NATURAL keyword indicates that a natural join is being performed. A natural join is based on all columns in the two tables that have the same name. It selects rows from the two tables that have equal values in the relevant columns. If two columns with the same name do not have compatible data types, then an error is raised. When specifying columns that are involved in the natural join, do not qualify the column name with a table name or table alias.
自然连接的详细用法,详见:
http://blog.csdn.net/holly2008/article/details/25501343
0 0
- OCP-1Z0-051 第120题 NATURAL JOIN自然连接
- OCP-1Z0-051 第121题 NATURAL JOIN自然连接
- OCP-1Z0-051 补充题库 第44题 NATURAL JOIN自然连接
- OCP-1Z0-051 第122题 NATURAL JOIN(自然连接)和USING子句的用法
- OCP-1Z0-051 第124题 JOIN内连接
- 自然连接 natural join
- OCP-1Z0-051 第127题 LEFT JOIN,RIGHT JOIN,FULL JOIN外连接的用法
- Oracle natural join(自然连接)
- Oracle natural join(自然连接)
- 自然连接(NATURAL JOIN)
- 自然连接(NATURAL JOIN)
- OCP-1Z0-051 第125题 self-join(自连接)和self-join(子查询)
- OCP-1Z0-051 第126题 LEFT OUTER JOIN,FULL OUTER JOIN,JOIN的使用
- 9.3.2 自然连接(NATURAL JOIN)
- NATURAL JOIN--自然连接的一些注意事项
- Oracle natural join(自然连接)
- OCP-1Z0-051 第128题 LEFT OUTER JOIN,RIGHT OUTER JOIN的使用
- OCP-1Z0-051 第131题 LEFT OUTER JOIN和RIGHT OUTER JOIN的用法
- 编写Java程序,计算100~999之间的全部“水仙花数”的平均值。
- MFC实现全局热键
- Android中ActivityManager学习笔记(3)
- OpenCV2马拉松第8圈——绘制直方图
- STL中用erase()方法遍历删除元素
- OCP-1Z0-051 第120题 NATURAL JOIN自然连接
- socket编程基础2
- UVA 10253 - Series-Parallel Networks(数论+计数问题+递推)
- leetcode第一刷_Search a 2D Matrix
- 仓央嘉措灵魂驻足的地方——香巴林卡
- ios推送
- Linux环境编程之文件I/O(一):文件描述符
- 安卓Theme属性简介
- 高海拔之恋-我的香巴林卡