Introduction to Databases with Stanford University : Relational Algebra Exercises
Jump to navigation
Jump to search
- Introduction to Databases by Standford University http://db-class.org
- Additional materials: http://openclassroom.stanford.edu/MainFolder/CoursePage.php?course=IntroToDatabases
1. Find all pizzas eaten by at least one female over the age of 20.
\project_{pizza} ( \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} ( \select_{gender='female'} ( ( \select_{pizzeria='Straw Hat'} Serves \join Eats ) \join Person ) )
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_{name='Amy' or name='Fay'} ( \select_{price < 10} Serves \join Eats ) )