Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Bars and Beers 1 Consider the following database consisting of six relations: Beers(name, manf): stores information about beers, including the manufacturer of each beer. Bars(name,

Bars and Beers 1
Consider the following database consisting of six relations:

Beers(name, manf): stores information about beers, including the manufacturer of each beer.

Bars(name, city, addr, license, phone): stores information about bars including their city, street address, phone number and their operating license.

Drinkers(name, city, addr, phone): stores information about drinkers, including their city, street address and phone number.

Likes (drinker, beer): indicates which drinker likes which beers (note that a drinker may like many beers and many drinkers may like the same beer).

Sells (bar, beer, price): indicates the price of each beer sold at each bar (note that each bar can sell many beers and many bars can sell the same beer, at possibly different prices).

Frequents (drinker, bar): indicates which drinker frequents which bars (note that each drinker may frequent many bars and many drinkers may frequent the same bar).

Attribute types: All attributes are of string type (e.g., Drinkers.name can be 'John McDonald'), except Sells.price is a number (e.g., Sells.price can be 2.25). Write SQL queries to answer the following:

Find the names of all beers, and their prices, served by the bar 'Blue Angel'.

Find the name and phone number of every drinker who likes the beer 'Budweiser'.

Find all bars frequented by both 'Vince' and 'Herb'.

Find all bars in 'Chicago' (and display all attributes) for which we know either the address (i.e., addr in our schema) or the phone number but not both.

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

Investing All In One

Authors: Eric Tyson

1st Edition

1119376629, 978-1119376620

Students also viewed these Databases questions