Question: Recall the simple Beers database ( used in the SQL queries videos ) and some ( approximate ) table definitions from that database: create table

Recall the simple Beers database (used in the SQL queries videos) and some (approximate) table definitions from that database:
create table Beers ( name text primary key, brewer text );
create table Drinkers ( name text primary key, address text, phone text );
create table Likes ( drinker text references Drinkers(name),
beer text references Beers(name),
primary key (drinker, beer));
Which of the following queries (maybe more than one) answers the question "Which drinkers like every beer?"
Note that there may be no drinkers that satisfy this property in the original instance of the database.
(a)
select d.name
from Drinkers d
where not exists (
(select L.beer as name from Likes L where L.drinker = d.name)
except
(select name from Beers)
);
(b)
select d.name
from Drinkers d
where not exists (
(select name from Beers)
except
(select L.beer as name from Likes L where L.drinker = d.name)
);
(c)
select d.name
from Drinkers d
where (select count(*) from Beers)
=
(select count(L.beer) from Likes L where L.drinker = d.name);
(d)
select d.name
from Drinkers d
where exists (
(select L.beer as name from Likes L where L.drinker = d.name)
except
(select name from Beers)
);
(e)
None of above options is correct

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!