1 . Which of the following query finds the total rating of the sailors who have reserved boat "103"?
- SELECT SUM(s.rating) FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103
- SELECT COUNT(s.rating) FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103
- SELECT s.rating FROM sailors s, reserves r WHERE s.sid = r.sid AND r.bid = 103
- SELECT SUM(s.rating) FROM sailors s, reserves r AND r.bid = 103
2 . The SELECT statement SELECT 'Hi' FROM DUAL WHERE NULL = NULL; Outputs
- NO
- TRUE
- FALSE
- NONE
3. Which of the following is illegal?
- SELECT SYSDATE - SYSDATE FROM DUAL
- SELECT SYSDATE - (SYSDATE - 2) FROM DUAL
- SELECT SYSDATE - (SYSDATE + 2) FROM DUAL
- None
4 . If a query involves NOT, AND, OR with no parenthesis:
- NOT will be evaluated first; AND will be evaluated second; OR will be evaluated last
- NOT will be evaluated first; OR will be evaluated second; AND will be evaluated last
- The order of occurrence determines the order of evaluation
- AND will be evaluated first; OR will be evaluated second; NOT will be evaluated last
5. Find the name of cities with all entries whose temperature is in the range of 71 and 89:
- FROM weather WHERE temperature NOT IN (71 to 89)
- FROM weather WHERE temperature NOT IN (71 and 89)
- FROM weather WHERE temperature NOT BETWEEN 71 to 89
- FROM weather WHERE temperature BETWEEN 71 AND 89
6 . Which of the following query finds the names of the sailors who have reserved at least one boat?
- SELECT DISTINCT s.sname FROM sailors s, reserves r WHERE s.sid = r.sid
- SELECT s.sname FROM sailors s, reserves r WHERE s.sid = r.sid
- SELECT DISTINCT s.sname FROM sailors, reserves WHERE s.sid = r.sid
- None
7 . Which of the following query finds colors of boats reserved by "Dustin"?
- SELECT DISTINCT b.color FROM boats b, sailors s WHERE s.sname = 'Dustin' AND s.sid = b.sid
- SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND s.sid = r.sid AND r.bid = b.bid
- SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND s.sid = r.sid
- SELECT DISTINCT b.color FROM boats b, reserves r, sailors s WHERE s.sname = 'Dustin' AND r.bid = b.bid
8 . Which of the following query finds the name of the sailors who have reserved at least two boats?
- SELECT DISTINCT s.sname FROM sailors s, reserves r1, reserves r2 WHERE s.sid = r1.sid AND r1.sid = r2.sid AND r1.bid ≠ r2.bid
- SELECT DISTINCT s.sname FROM sailors s, reserves r1, reserves r2 WHERE s.sid = r1.sid AND COUNT(r1.bid) > r2.bid
- SELECT DISTINCT s.sname FROM sailors s, reserves r1, reserves r2 WHERE s.sid = r1.sid AND r1.sid = r2.sid AND r1.bid <> r2.bid
- All of these
9 . Which command undo all the updates performed by the SQL in the transaction?
- ROLLBACK
- COMMIT
- TRUNCATE
- DELETE
10. Find all the cities whose humidity is 89:
- SELECT city WHERE humidity = 89
- SELECT city FROM weather WHERE humidity = 89
- SELECT humidity = 89 FROM weather
- SELECT city FROM weather