122.View the Exhibit for the structure of the STUDENT and FACULTY tables.
2016-03-07 17:19
465 查看
122.View the Exhibit for the structure of the STUDENT and FACULTY tables.
You need to display the faculty name followed by the number of students handled by the faculty at the
base location.
Examine the following two SQL statements:
Statement 1
SQL>SELECT faculty_name,COUNT(student_id)
FROM student JOIN faculty
USING (faculty_id, location_id)
GROUP BY faculty_name;
Statement 2
SQL>SELECT faculty_name,COUNT(student_id)
FROM student NATURAL JOIN faculty
GROUP BY faculty_name;
![](http://img.blog.csdn.net/20160307171916512?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
Which statement is true regarding the outcome?
A.Only s tatement 1 executes successfully and gives the required result.
B.Only statement 2 executes successfully and gives the required result.
C.Both statements 1 and 2 execute successfully and give different results.
D.Both statements 1 and 2 execute successfully and give the same required result.
答案:D
解析:从两个表的结构中可以看出来他们相同名字的字段是faculty_name和location_id,而using使用的
就是这两个字段,因此和natural join是等价的,所以选择D
You need to display the faculty name followed by the number of students handled by the faculty at the
base location.
Examine the following two SQL statements:
Statement 1
SQL>SELECT faculty_name,COUNT(student_id)
FROM student JOIN faculty
USING (faculty_id, location_id)
GROUP BY faculty_name;
Statement 2
SQL>SELECT faculty_name,COUNT(student_id)
FROM student NATURAL JOIN faculty
GROUP BY faculty_name;
Which statement is true regarding the outcome?
A.Only s tatement 1 executes successfully and gives the required result.
B.Only statement 2 executes successfully and gives the required result.
C.Both statements 1 and 2 execute successfully and give different results.
D.Both statements 1 and 2 execute successfully and give the same required result.
答案:D
解析:从两个表的结构中可以看出来他们相同名字的字段是faculty_name和location_id,而using使用的
就是这两个字段,因此和natural join是等价的,所以选择D
相关文章推荐
- linux远程下载文件 的两种方法之 ftp命令和scp命令
- golang martini 源码阅读笔记之inject
- spring mvc 集成memcached缓存服务器
- IE 下JS上传文件时出现“拒绝访问”的解决方案
- NSSet类型 以及与NSArray区别
- Installing the Eclipse Plugin
- 概率论与数理统计习题: 某县城有1万辆自行车,其牌照号码从00001到10000,求在该县城偶遇一辆自行车的牌照号码中有数字8的概率.
- 1000==1000? 无花括号的for循环,*.05x3=?
- 深入剖析Java中的装箱和拆箱
- thinking between bindService&startService
- batch语言卸载msi安装程序
- 阶乘因式分解(找出数n的阶乘中含有几个素数m)
- android app如何上线发布
- android 设置 永不休眠
- 9个令人震惊的WebGL示例
- python入门(二)
- 剑指offer-调整数组顺序使奇数位于偶数前面
- const关键字区别
- iOS开发中控制屏幕旋转,个别界面强制横屏
- 关于Hadoop_env.sh中的HADOOP_CLASSPATH