Chapter five: difficult beer database

Queries:

  1. All drinkers that go to A BAR that serves BEERS they LIKE.
  2. All drinkers that go to BARS that serve A BEER they DON'T LIKE.
  3. All drinkers that go ONLY to BARS that serve A BEER they LIKE.
  4. All drinkers that ONLY go to BARS that serve NO BEER they LIKE.
  5. All drinkers that ONLY go to BARS that serve ONLY BEER they LIKE.

Database:

likes (drinker, beer)
visits (drinker, bar)
serves (bar, beer)

Examples of the tables:

 Drinker Beer   Drinker Bar   Bar Beer
Jan Heineke   Jan Cheers   Cheers Duvel
Jan  Grolsch    Jan  California   Cheers  Grolsch 
Jan  Amstel    Jaap California   Cheers  Heineken
Jan  Leffe    Jaap   Rock cafe   Cheers  Amstel
Jan Duvel    Peter  Cheers   Cheers  Leffe
Jaap Grolsch   Peter Rock cafe   California Grolsch
Jaap  Duvel   Paul Cheers   California Leffe
Peter  Koning   Paul   Flamingo   Rock cafe  Heineke 
Peter  Duvel   Mary California    Rock cafe Duvel
Peter Heineken   Mary Flamingo   Rock cafe Amstel
Peter  Leffe   Sue Rock cafe   Flamingo  Heineken
Paul Heineken   Jolande California   Flamingo Grolsch
Paul Duvel   Jolande Cheers   Flamingo Amstel
Paul  Grolsch   Susan Cheers   Old dutch  Koning
Mary Grolsch   Susan Old dutch   Old dutch Heineken
Sue Amster     Old dutch Amstel
Sue Koning         Old dutch Grolsch
Sue Duvel             
Jolande Heineken        
Jolande Grolsch        
Jolande Amstel        
Susan Duvel        
Susan  Koning