I have 2 tables: one called likes with columns of drinkers and the beers they like. Another one called sells with columns of bar names and the beers they sell.
I am having a tough time with a particular query:
"Drinkers who like every beer served by Bobbys"
I have worked through the following (flawed) SQL Query:
Select distinct a.drinker
from likes a
where exists
(
select *
from likes b, sells t
where a.drinker = b.drinker
and a.beer = t.beer
and t.bar = 'Bobbys'
);
But this query returns the drinkers who like some beers served by Bobbys, not all beers. As long as a drinker likes a beer served by Bobbys, its name is returned, which is not what the statement is asking.
I am having a hard time logically changing this query to include only those drinkers who like all the beers served by the bar Bobbys and not just some.
Any help would be much appreciated. Thank you.