作者Mayinggo (马赢狗)
看板Examination
标题[课业] 资料库两题
时间Tue Jun 11 03:37:22 2013
某年云科大资管所考题
1. A SQL SELECT statement contains a nested query in the WHERE clause,comparing
the value of an attribute to the values returned by the nested SELECT with an
IN predicate. Which of the following predicates can be used in that statement
instead of IN?
(A)=SOME (B)=ALL
(C)=ANY (D)=EVERY
答案是C
查了一下用法IN=ANY=SOME
所以不选SOME的理由是 还是答案其实可以选
2. Two tables are given: STUDENT(StudNO,Name,Department) and GRADES(StudNo,
Course,Grade). Which of the given SQL statements will retrieve the names
of
students who got an A in each course they passed?
(A) SELECT name
FROM student
WHERE NOT EXISTS(SELECT *
FROM grades
WHERE grade IN('B','C')and
student.studno=grades.studno);
(B) SELECT name
FROM student JOIN grades ON student.studno=grades.studno
WHERE grade='A';
(C) SELECT name
FROM student,grades
WHERE grade='A'and student.studno=grades.studno;
(D) SELECT name
FROM student
WHERE 'A'=ALL(SELECT grade
FROM grades
WHERE student.studno=grades.studno);
已知题目没有提到等第有哪些 所以不考虑A
由於grades的属性没有name 所以C也不考虑
B跟D不知道差在哪 答案是D 可是不知道B错在哪
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.35.166.245
1F:推 MJdavid:请用[考题]标题分类附上出处 置底文有修改标题教学 感谢 06/11 13:08
※ 编辑: Mayinggo 来自: 114.35.166.245 (06/11 14:09)