Question

Consider a database with the following schema. Return SQL code for the following queries.

Consider a database with the following schema.

BARS(name,license,city,phone,addr);

BEERS(name,manf);

DRINKERS(name,city,phone,addr);

LIKES(drinker,beer); 

FREQUENTS(drinker,bar); 

SELLS(bar,beer,price); 


Return SQL code for the following queries.


1.  Find all distinct drinkers whose phone numbers come from area code 917 and who like Budweiser or Bud (synonim!)



2. What beers does Mike like?



3. Which town has the most drinkers?



4. What bars are frequented by drinkers from that town (3)?



5. Provide all bars which serve beers that Mike likes



6. Who likes the at least one same beer that Joe or Mike like?



7.  All bars which sell at last one beer which is liked by at least one drinker who frequents these bars



8. Drinkers who like some beers sold by Caravan bar



9. Bars which sell Budweiser and are frequented by some drinkers who like Budweiser



10.  Bars which are frequented by Mike  and Steve



11. Drinker who like at least two beers that Mike likes



12. Bars which sell at least 3 beers that Mike likes (do not use COUNT)



0 0
Add a comment Improve this question Transcribed image text
Answer #1

answered by: anonymous
Add a comment
Know the answer?
Add Answer to:
Consider a database with the following schema. Return SQL code for the following queries.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Relational algebra pls. Appreciate it!(Queries are detailed) Consider the following relational database that stores information about...

    Relational algebra pls. Appreciate it!(Queries are detailed) Consider the following relational database that stores information about bars and customers: Drinker (name, address) Bar (name, address) Beer (name, brewer) Frequents (drinker, bar, times a week) Likes (drinker, beer) Serves (bar, beer, price) Write the following queries in relational algebra: (5 points) Find all drinkers who frequent only those bars that serve some beers they like. 5 points) Find all drinkers who frequent every bar that serves some beers they like (10...

  • Consider a database with the following schema. LIKES(drinker,beer); /* key: all columns */ FREQUENTS(drinker,pub); /* key:...

    Consider a database with the following schema. LIKES(drinker,beer); /* key: all columns */ FREQUENTS(drinker,pub); /* key: all columns */ SERVES(pub,beer,cost); /* key: (pub,beer) */ Write the following queries in relational algebra. You can use the math notation (greek letters sigma, pi, etc.) or the ASCii "linear" notation I used in class. In order to make things more clear, please use intermediate results defined with the assignment notation in the algebra: R(a,b) := <rel-alg expression>. Try to give meaningful names for...

  • Consider a database with the following schema: Person ( name, age, gender ) name is a...

    Consider a database with the following schema: Person ( name, age, gender ) name is a key Frequents ( name, pizzeria ) (name, pizzeria) is a key Eats ( name, pizza ) (name, pizza) is a key Serves ( pizzeria, pizza, price ) (pizzeria, pizza) is a key Write SQL clauses for the queries given: e.   Find all pizzerias that are frequented by only females or only males. f.   For each person, find all pizzas the person eats that are...

  • EXERCISE 1 (SQL Queries) Consider the following schema: SUPPLIERS (SID : integer, SNAME : string, CITY...

    EXERCISE 1 (SQL Queries) Consider the following schema: SUPPLIERS (SID : integer, SNAME : string, CITY : string) PARTS (PID : integer, PNAME : string, COLOR : string) CATALOG (SID : integer, PID : integer, COST : real) The key fields are underlined, and the domain of each field is listed after the field name. Thus, SID is the key for SUPPLIERS, PID is the key for PARTS, and SID and PID together form the key for CATALOG. The CATALOG...

  • Create the following SQL Server queries that access the Northwind database Same as problem 3 but,...

    Create the following SQL Server queries that access the Northwind database Same as problem 3 but, limit the list to all customers who placed 3 or more orders. The product id, product name, last date that the product was ordered for all items in the Grains/Cereals category. (Hint: Use MAX) The product ID, product name, and number of distinct customers who ordered that product in 1996 Thank you. Categories Customers Employees Order Details Orders Products Shippers 9 CategoryID CategoryName Description...

  • Anheuser-Busch in the Czech Republic In this activity, we will review a dispute between Anheuser-Busch and the Czech st...

    Anheuser-Busch in the Czech Republic In this activity, we will review a dispute between Anheuser-Busch and the Czech state-owned brewery Budejovicky Budvar over the use of the name Budweiser and its derivations. It is premised on the role that trademarks can play within an international marketing scenario. Here we focus on the importance of intellectual property. It contrasts the common law trademark prior use verses the code law registration issue. Businesses face a multitude of problems in their efforts to...

  • Small craft brewers like Port City Brewing Company of Alexandria, VA, are very encouraged by the...

    Small craft brewers like Port City Brewing Company of Alexandria, VA, are very encouraged by the Department of Justice lawsuit because the bigger the big beer companies get, the harder it is for the smaller brewers to get a foothold in an increasingly competitive beer market. Which of the five direct conflict management strategies is being utilized by the large beer makers as it relates to the lawsuit by the Department of Justice? Direct Conflict Management Strategies 1.Accommodation or Smoothing...

  • Using the database: Write SQL queries for each of the questions below. 1. Find the media...

    Using the database: Write SQL queries for each of the questions below. 1. Find the media type which has 100 or more tracks. Print the name of such media type. Number of rows returned in the result = 3 A) Find the playlists which have one or more tracks that have never been purchased in California (CA). Print the Id, and the name of such playlists. Number of rows returned in the result = 18 B) Find the customers who...

  • Given the following schema: I would like to know the SQL queries to: 1. Total up...

    Given the following schema: I would like to know the SQL queries to: 1. Total up the number of checkouts made on each month of the year. Then print the month (spelled out completely) and the total number of corresponding checkouts next to it. That is, print "January" and total number of checkouts made in January, and so on. 2. Show the furniture styles that are checked-out on Sundays only. That is, none of the furniture in that style must...

  • May I ask the SQL code as follows? The relational database moviedb has the following database...

    May I ask the SQL code as follows? The relational database moviedb has the following database schema: Movie(title, production year, country, run time, major genre) primary key : {title, production year} Person(id, first name, last name, year born) primary key : {id} Award(award name, institution, country) primary key : {award name} Restriction Category(description, country) primary key : {description, country} Director(id, title, production year) primary key : {title, production year} foreign keys : [title, production year] ⊆ Movie[title, production year] [id]...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT