Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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):

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:

What is the average price of 'Budweiser' in 'Chicago'?

How many bars in 'Chicago' sell a beer liked by 'John' for less than 5.00?

Find the names of the bars in 'Boston' that sell 'Budweiser' for the cheapest price (compared with other bars in 'Boston').

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

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago