I'm new to mysql and I need some more practice with this stuff since were going to have a test soon (this is not a homework assignment). One thing I still don't get is how to check if two tables contain an equal set of values.
Heres the practice problem I came up with based on a problem given where we had to find all sailors who rented all boats after a certain date.
I need to be able to see what sailors have rented the same boats as john doe rented after May 5, 2009. Heres my setup:
Sailor ( name: varchar(20), sid: integer) Boat ( name: varchar(20), bid: integer) Rental ( sid: integer, bid: integer, day: date)
and what I've tried so far:
create view john_doe_rentals as select b.bid from sailor s, boat b, rental r where s.sid = r.sid and ( = 'John Doe') and r.date > "5/5/09" and rbid = b.bid; create view sailor_rentals as select s.name, r.bid from sailor s, result r, john_doe_rentals j where s.sid = r.sid and (s.name != 'John Doe') and r.date > "5/5/09" and j.bid = r.bid; select name from sailor_rentals s where exist (select * from john_doe_rentals);
This gives me a syntax error. If anybody could help me out it'd be greatly appreciated.