Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Relational Algebra Reference Guide: http://www.db-class.org/course/resources/index?page=ra
- Databases in Use: http://www.db-class.org/course/resources/index?page=pizzadata
- 1. Find all pizzas eaten by at least one female over the age of 20.
- \project_{pizza} (
- (\project_{name}
- \select_{gender='female' and age > 20}
- Person
- )
- \join Eats
- )
- 2. Find the names of all females who eat at least one pizza served by Straw Hat. (Note: The pizza need not be eaten at Straw Hat.)
- \project_{name}(
- (\project_{name}
- \select_{gender='female'}
- Person
- )
- \join
- (
- ( Eats)
- \join
- ( \select_{pizzeria='Straw Hat'} Serves)
- )
- )
- 3. Find all pizzerias that serve at least one pizza for less than $10 that either Amy or Fay (or both) eat.
- \project_{pizzeria} (
- ( \select_{price < 10} Serves )
- \join
- ( \select_{name='Amy' or 'Fay'} Eats )
- )
- 4. Find all pizzerias that serve at least one pizza for less than $10 that both Amy and Fay eat.
- \project_{pizzeria} (
- ( \select_{price < 10} Serves )
- \join
- ( \select_{name='Fay'} Eats )
- )
- 5. Find the names of all people who eat at least one pizza served by Dominos but who do not frequent Dominos.
- \project_{name}
- (\select_{pizza='cheese' or pizza='mushroom'} Eats
- \join Person)
- \diff \project_{name}(\select_{pizzeria='Dominos'} Frequents
- \join Person)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement