Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions