[考題] 資料庫兩題

看板Examination作者 (馬贏狗)時間11年前 (2013/06/11 03:37), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
某年雲科大資管所考題 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

06/11 13:08, , 1F
請用[考題]標題分類附上出處 置底文有修改標題教學 感謝
06/11 13:08, 1F
※ 編輯: Mayinggo 來自: 114.35.166.245 (06/11 14:09)
文章代碼(AID): #1HjYhrkQ (Examination)