How to find all pizzerias that serve every pizza eaten by people over 30?

find all pizzas eaten by at least one female over the age of 20.
find all pizzerias that are frequented by only females or only males
relational algebra division
relational algebra queries examples with solutions pdf
relational algebra examples with solutions
write the following queries in relational algebra
relational algebra practice questions
ra expressions

I'm following the Stanford Database course and there's a question where we have Find all pizzerias that serve every pizza eaten by people over 30 using Relational Algebra only.

The problem consist of a small database with four relations:

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

I know how to find which pizza's people over 30 eat and make a cross-product of them, so I could check which pizzeria has both.

I can make a list of all the pizzeria's that serve those pizza's, but I have no idea how to remove any pizzeria that only have one combination (like Dominos).

Chicago Pizza   cheese  cheese
Chicago Pizza   cheese  supreme
Chicago Pizza   supreme cheese
Chicago Pizza   supreme supreme
Dominos         cheese  cheese
Dominos         cheese  supreme

The Q&A forums tell us to use division and point us to several presentations. While I get what the result of the action would be, I don't really understand how to translate the formula's into relational algebra syntax.

Could anyone explain me what I'm missing, hopefully without giving the solution outright?


The solution is the join div operator http://en.wikipedia.org/wiki/Relational_algebra#Division_.28.C3.B7.29

See http://oracletoday.blogspot.com/2008/04/relational-algebra-division-in-sql.html

Find all pizzerias that serve ONLY pizzas eaten by people over 30 , Don't jump to conclusions. Read carefully. project {pizza} (select {age>'30'} (​Person) join Eats). That expression involves people over 30. I'm following the Stanford Database course and there's a question where we have Find all pizzerias that serve every pizza eaten by people over 30 using Relational Algebra only.


Definitely this is the concept of division operator in relational algebra.

But I tried on that course. The RA Relational Algebra Syntax doesn't support dev operator. So I used diff and cross instead. Here is my solution:

\project_{pizzeria}(Serves)
\diff
\project_{pizzeria}(
    (\project_{pizzeria}(Serves) 
    \cross 
    \project_{pizza}(\project_{name}(\select_{age>30}(Person))\join Eats))
    \diff
    \project_{pizzeria,pizza}(Serves)
)

Find all pizzerias that serve every pizza eaten by people over 30 , Question 9 Find all pizzerias that serve every pizza eaten by people over 30. (​This query is very challenging; extra congratulations if you get it  Encountered this Relational Algebra exercise in the Introduction to Databases free online course offered by Stanford University in Fall, 2011. Question 9 Find all pizzerias that serve every pizza eaten by people over 30. (This query is very challenging; extra congratulations if you get it right.) Person name age gender Amy 16 female Ben 21 male…


  1. On slide 6, note that n is (3 1 7).

  2. On the next slide, o / n results in (4 8).

  3. If o would also have (12 3) and (12 1) but not (12 7), 12 would not be part of o / n.

You should be able to fill in an example in the formula on Slide 16 and work it out.

  1. In your case, we take ɑ to be:

    Chicago Pizza   cheese  cheese
    Chicago Pizza   cheese  supreme
    Chicago Pizza   supreme cheese
    Chicago Pizza   supreme supreme
    Dominos         cheese  cheese
    Dominos         cheese  supreme
    
  2. Then we take β to be:

    cheese cheese
    cheese supreme
    supreme cheese
    supreme supreme
    
  3. The result of ɑ / β would then be:

    Chicago Pizza
    

Dominos is not part of this because it misses (supreme cheese) and (supreme supreme).

db_course_stanford_winter2013/02_Relational_Algebra_Exercises , Can you please help me to solve the following problems 1) Design a normalized database 2) Write a query for the report 3) Is there any site that gives these kinds​  Contribute to sumeetsk/dbclass development by creating an account on GitHub. only pizzas eaten by people over 30. \project_{pizzeria} Serves that serve every


Try doing a join using conditions rather than a cross. The conditions would be sure that you match up the records correctly (you only include them if they are in both relations) rather than matching every record in the first relation to every record in the second relation.

[PDF] Relational-algebra exercises, Find all pizzerias that serve every pizza eaten by people over 30. (\project_{​pizzeria} (Serves \join (\project_{pizza} (\select_{age>30} Person \join Eats)))) \​diff  Find all pizzas eaten by at least one female over the age of 20. Find all pizzerias that serve at least one pizza for less than $10 Find all pizzas eaten by


This is the annotation of another answer. My brain was hurting and so I tried a concise and complete answer posted earlier and it worked. But that’s merely "giving a man a fish" and so I had to see what was behind it.

Here then is ChrisChen3121’s Jan 22 ‘14 solution with changes only to parenthesis, comments, and line breaks. Most parenthesis line up vertically with their match. Hopefully that makes things easy to see. Following the aesthetically re-written code, there are the intermediate relations produced in an attempt to visualize/conceptualize the solution.

Long story short:

--Find target pizzas;

--With \cross, build a fantasy super-set list as if all pizzerias served said pies;

--Subtract out from there, all "Actually-Served" pies to create a "These-Are-Missing" list;

--Finally, from [a fresh copy of] "reality", subtract out the "missing" and... that’s about it.

\project_{pizzeria}(Serves)// "Actual" list of what pizzerias serve. Results shown below. 
\diff
\project_{pizzeria}
(// After the diff, this is a list of "What's Missing". Results shown below
    (// Super-set of all pizzerias combined with all "over30pies". Results shown below 
     // NOTE: Some combos here do not match reality
        \project_{pizzeria}(Serves)
        \cross
        (// "over30pies": Within these parentheses produces table shown below
            //Next line is what I used, it’s effectively equivalent, yes.
            //roject_{pizza} (                \select_{age > 30 }  Person  \join Eats)
            \project_{pizza} (\project_{name}(\select_{age > 30 } (Person))\join Eats)
        )
    )
    \diff
    ( // "Actual" list of what pizzerias serve. Results shown below. 
        \project_{pizzeria,pizza}(Serves)
    )
)

// "over30pies", target pies (those eaten by 30+ year-olds)

cheese 
supreme

// Super-Set of all pizzerias combined with all target ("over30pies") // NOTE: some combos do not match reality.

Chicago Pizza | cheese
Chicago Pizza | supreme
Dominos | cheese
Dominos | supreme
Little Caesars | cheese
Little Caesars | supreme
New York Pizza | cheese
New York Pizza | supreme
Pizza Hut | cheese
Pizza Hut | supreme
Straw Hat | cheese
Straw Hat | supreme

// Actual, full list of which pizzerias actually serve what

Chicago Pizza | cheese
Chicago Pizza | supreme
Dominos | cheese
Dominos | mushroom
Little Caesars | cheese
Little Caesars | mushroom
Little Caesars | pepperoni
Little Caesars | sausage
New York Pizza | cheese
New York Pizza | pepperoni
New York Pizza | supreme
Pizza Hut | cheese
Pizza Hut | pepperoni
Pizza Hut | sausage
Pizza Hut | supreme
Straw Hat | cheese
Straw Hat | pepperoni
Straw Hat | sausage

//Difference (what’s left over) after the "Actual" is subtracted from the fantastical "Super-Set". This then, represents what’s MISSING or, "These pizzeria do not serve the required pizza listed"

Dominos | supreme
Little Caesars | supreme
Straw Hat | supreme

1 Find all pizzerias frequented by at least one person under the age , How to find all pizzerias that serve every pizza eaten by people over 30? - relational-algebra. Find the names of all people who frequent only pizzerias serving at least one pizza they eat. 8. Find the names of all people who frequent every pizzeria serving at least one pizza they eat π name (Person) - π name (π name, pizzeria (Eats Servers) -Frequents) 9. Find the pizzeria serving the cheapest pepperoni pizza.


80 Interesting Facts About Pizza That Will Make You Look Cool (2020), Eats ( name, pizza ). Serves ( pizzeria, pizza, price ). 18. Find the names of all people who frequent every pizzeria serving at least one pizza they eat. π name. Now that it's past the due date for this assignment, where can I find solutions? Specifically I want the answers to 7 and 9, as I couldn't figure out the 'correct' way to do these with relational algebra. 7: Find the age of the oldest person (or people) who eat mushroom pizza. 9: Find all pizzerias that serve every pizza eaten by people over 30.


The 50 Best Pizzas In The World – 2019, For each person, find all pizzas the person eats that are not served by any of all people who frequent every pizzeria serving at least one pizza they eat π name  "We're not dead yet." Check out more awesome videos at BuzzFeedBlue! https://bit.ly/YTbuzzfeedvideo https://bit.ly/YTbuzzfeedblue1 https://bit.ly/YTbuzzfeedviolet


Pizza accounts for more than 10 percent of all food service sales. Americans eat approximately 100 acres of pizza a day or about 350 slices per second. 30. The world's fastest pizza maker can make 14 pizzas in 2 minutes and 35 seconds​. The restaurant chain's founder, Tom Monaghan, is one of three people in the​  Introduction to Databases with Stanford University : Relational Algebra Exercises serve only pizzas eaten by people over 30. Find all pizzerias that serve