Sname from sailors s where ssid in select from where

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: HERE S.sid IN ( SELECT FROM WHERE 34 SELECT FROM WHERE R.sid Reserves R R.bid=103); R.bid=103); 35 35 S.sname Sailors S EXISTS ( SELECT FROM WHERE * Reserves R R.bid=103 R.bid=103 AND S.sid=R.sid); S.sid= R.sid); 36 Query Examples (continued) Query Examples (continued) (Q6) Find names of sailors who have reserved both a red boat and a green boat. (Q2) Find the names of sailors who have reserved a red boat. SELECT FROM SELECT S.sname FROM Sailors S, Reserves R, Boats B WHERE S.sid = R.sid AND R.bid = B.bid AND B.color = ‘red’; red’ WHERE S.sname Sailors S, Reserves R1, Boats B1, Reserves R2, Boats B2 S.sid = R1.sid AND R1.bid = B1.bid AND S.sid = R2.sid AND R2.bid = B2.bid AND B1.color = ‘red’ AND B2.color = ‘green’; red’ green’ 37 37 Query Examples (continued) (Q6) 38 Query Examples (continued) Find names of sailors who have reserved both a red and a green boat. (Q6) Alternate solution with small bug (to be solved later): Find names of sailors who have reserved both a red and a green boat. SELECT FROM WHER...
View Full Document

This note was uploaded on 10/15/2012 for the course CSE 4503 taught by Professor Edallen during the Fall '12 term at Mississippi State.

Ask a homework question - tutors are online