Ics321-20091001-quiz - ICS 321 Fall 2009 SQL Common Mistakes Asst Prof Lipyeow Lim Information Computer Science Department University of Hawaii at

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
ICS 321 Fall 2009 SQL Common Mistakes Asst. Prof. Lipyeow Lim University of Hawaii at Manoa 9/31/2009 1 Lipyeow Lim -- University of Hawaii at Manoa
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Q1: Find the sids of sailors who have never reserved a boat What I had in mind: SELECT S.sid FROM Sailors S EXCEPT SELECT R.sid FROM Reserves R 9/31/2009 Lipyeow Lim -- University of Hawaii at Manoa 2
Background image of page 2
#1 SELECT S1.sid FROM Sailors S1 WHERE NOT EXISTS ( SELECT R1.sid FROM Reserves R1, Sailors S2 WHERE R1.sid=S2.sid ) 9/31/2009 Lipyeow Lim -- University of Hawaii at Manoa 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
#2 SELECT S.sid FROM Sailors S WHERE S.sid NOT IN ( SELECT R.sid FROM Reserves R ) 9/31/2009 Lipyeow Lim -- University of Hawaii at Manoa 4
Background image of page 4
#3 SELECT S1.sid FROM Sailors S1 WHERE EXISTS ( SELECT R1.sid FROM Reserves R1 WHERE R1.sid=S1.sid ) 9/31/2009 Lipyeow Lim -- University of Hawaii at Manoa 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
have never reserved a boat Re-use answer from Q1 SELECT S2.sname FROM Sailors S2 WHERE S2.sid IN (
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/15/2010 for the course ICS 321 taught by Professor Lim during the Fall '09 term at University of Hawaii, Manoa.

Page1 / 12

Ics321-20091001-quiz - ICS 321 Fall 2009 SQL Common Mistakes Asst Prof Lipyeow Lim Information Computer Science Department University of Hawaii at

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online