国际空间研究组织 | ISRO CS 2017 – 5 月 |问题 7
以下 SQL 查询的输出是什么?
select count(*) from ((select Employee, Department from Overtime_allowance) as S
natural join (select Department, OT_allowance from Overtime_allowance) as T);
(一) 16
(乙) 4
(三) 8
(D)以上都不是
(E)无答案:(乙)
解释: (select Employee, Department from Overtime_allowance) as S
自然加入(从Overtime_allowance中选择部门,OT_allowance)为T)
Table S Table R
Employee Department Department OT_allowance
Rama Mechanical Mechanical 5000
Gopi Electrical Electrical 2000
Sindhu Computer Computer 4000
Mahesh Civil Civil 1500
现在,当我们对 S 和 R 应用自然连接时,它匹配两个表中的公共属性 Department 并输出公共元组。因此,将给出 4 个元组作为输出。
正确选项(B)
这个问题的测验