$24
Directions: For each question, write a corresponding relational algebra query that will return the desired result.
Turning In: Please write out the queries nicely (I need to be able to read them) on a sheet of paper. Take a picture of the paper that includes your name and date.
The following questions use the Cars schema:
cars(Model, MPG, Cylinders, Displacement, Horsepower, Weight, Acceleration, Year, Origin)
How much horsepower does a ford fiesta have?
Which car manufacturer origin has the lowest average HP? (sort by average)
Write a query to return the average displacement per origin+cylinder combo.
Write a query to only return the cylinders and average displacement, where the origin is Japan, from the query in #3.
The following questions use the 4 schemas listed below:
Person (name, age, gender)
Frequents (name, pizzeria)
Eats (name, pizza)
Serves (pizzeria, pizza, price)
All of these questions will use joins.
Find all pizzerias frequented by males under the age of 18.
Find the names of all females who eat either mushroom or pepperoni pizza.
Find all pizzerias that are frequented by only females.
Find the names and ages of all males who eat both mushroom and pepperoni pizza.
Find the average price that Joe pays for all the pizzerias he frequents.