Question

Relational algebra pls. Appreciate it!(Queries are detailed)
Consider the following relational database that stores information about bars and customers: Drinker (name, address) Bar (nam

(5 points) Find all drinkers who frequent only those bars that serve some beers they like. 5 points) Find all drinkers who fr

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

Answer is as follows :

Relational Algebra for given scenarios are :

Answer 1 :

In this we get to know that we need four tables i.e. Drinker, Likes, Frequents and Servers.

Drinker is used to get data about drinker, Likes defines the beer he/she likes, Frequents finds the corresponding bar and servers helps to find the only corresponding bars.

\proddrinker.name, drinker.address ( Drinker \Join Likes \Join Frequents \Join Serves) \sigma drinker.name = likes.drinker \wedge likes.drinker = frequents.drinker \wedge frequents.beer = servers.beer ;

Answer 2 :

In this we get to know that we need four tables i.e. Drinker, Likes, Frequents

Drinker is used to get data about drinker, Likes defines the beer he/she likes, Frequents finds the corresponding bar. For every bar details, we get bar names form frequents table too.

\proddrinker.name, drinker.address ( Drinker \Join Likes \Join Frequents) \sigma drinker.name = likes.drinker \wedge likes.drinker = frequents.drinker ;

Answer 3 :

In this we need only two tables i.e. Drinker and Likes and Frequents

Drinker is used to get data about drinker and Likes to find the which beer drink by Amy. Frequents used to find same match of same beers which liked by Amy.

\proddrinker.name, drinker.address ( Drinker \Join Likes ) \sigma likes.drinker = "Amy" \wedge likes.beer = frequents.drinker ;

if there is any query please ask in comments..

Add a comment
Know the answer?
Add Answer to:
Relational algebra pls. Appreciate it!(Queries are detailed) Consider the following relational database that stores information about...
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
  • 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 likes6. Who likes the at least one same beer that Joe or Mike like?7.  All bars...

  • 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 following relational database schema and translate the queries ‘a’ and ‘b’ into relational algebra expressions...

    Consider following relational database schema and translate the queries ‘a’ and ‘b’ into relational algebra expressions Teacher(ID, Name, Designation, Phone, Address) Course(CourseCode, CourseName, CreditHour) Taught(TeacherID, CourseCode, Semester) a. SELECT Name, Address FROM Teacher, Taught WHERE Teacher.ID=Taught.TeacherID and CourseCode=’IT344’ b. SELECT CourseName FROM Course, Taught WHERE Course.CourseCode=Taught.CourseCode and TeacherID=200

  • Translate the following queries into extended Relational Algebra (Use COUNT to do this one) Find every...

    Translate the following queries into extended Relational Algebra (Use COUNT to do this one) Find every person who is skilled in the manufacture of every product manufactured by 111-22-3333. company(co_name, govt id, ceo_ssn, hq_loc) division(co id, div name, subdiv_of, dir_ssn, div_hq) site(co id, divname, loc) product(prod id, manuf co, manuf_div, loc, prod_descr) person(ssn, name, address) works_for(ssn, co id, div_name, salary, emp_id, sup_ssn) skill(ssn, prod id, manuf co company(co_name, govt id, ceo_ssn, hq_loc) division(co id, div name, subdiv_of, dir_ssn, div_hq) site(co...

  • Given the following relational database schema (primary keys are bold and underlined). Answer questions 2.1 to 2.4 Orde...

    Given the following relational database schema (primary keys are bold and underlined). Answer questions 2.1 to 2.4 Orders(orderld, customerld, dateOrdered, dateRequired, status) Customer(customerld, customerLastName, customerStreet, customerCity, customerState, customer Lip OrderDetails(orderld.productld, quantity, lineNumber, amount) Products(productld, name, description, quantity, unitPrice) Account(accountNumber, customerld, dateOpened, creditCard, mailingStreet, mailingCity, mailingState, mailingZip) 2.1 (2 Points) List all possible foreign keys. For each foreign key list both the referencing and referenced relations. 2.2 (2 Points) Devise a reasonable database instance by filling the tables with data of...

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
ADVERTISEMENT