algebra re laci on al

2
a. Find all pizzerias frequented by at least one person under the age of 18 b. π pizzeria ( σ age<18 ( Person ⋈ Frequents)) Find the names of all females who eat either mushroom or pepperoni pizza (or both). c. π name person ( σ ( gender=F) ( pizza=mushroom ∨ pizza=pepperoni) ( Person ⋈Eats ) ) Find the names of all females who eat both mushroom and pepperoni pizza. d. π name person ( σ ( gender=F) ( pizza=mushroom ∧ pizza=pepperoni) ( Person ⋈ Eats ) ) Find all pizzerias that serve at least one pizza that Amy eats for less than $10.00. e. π pizzeria ( σ name= Amy ∧ price<10 ( Eats ⋈ Serves) ) Find all pizzerias that are frequented by only females or only males. f. π pizzeria ( σ gender= M ( Frequents ⋈Person ) ) ∪π pizzeria ( σ gender= F ( Frequents ⋈ P For each person, find all pizzas the person eats that are not served by any pizzeria the person frequents. Return all such person (name) / pizza pairs. g. Eatsπ namepizza ( Frequents ⋈ Serves) ¿ Find the names of all people who frequent only pizzerias serving at least one pizza they eat. h. π name ( Person) π name ( Frequents π namepizzeria ( Eats ⋈ Serves) ) Find the names of all people who frequent every pizzeria serving at least one pizza they eat. π name ( Person) π name ( π namepizzeria ( Eats ⋈ Serves) Frequents ) i . Find the pizzeria serving the cheapest pepperoni pizza. In the case of ties, return all of the cheapest-pepperoni pizzerias.

Upload: aldo-alvarado

Post on 19-Jan-2016

60 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Algebra Re Laci on Al

a.Find all pizzerias frequented by at least one person under the age of 18

b.

π pizzeria(σage<18(Person⋈Frequents))

Find the names of all females who eat either mushroom or pepperoni pizza (or

both).

c.

πnameperson(σ (gender=F )∧ (pizza=mushroom∨ pizza=pepperoni ) (Perso n⋈ Eats ))

Find the names of all females who eat both mushroom and pepperoni pizza.

d.

πnameperson(σ (gender=F )∧ (pizza=mushroom∧ pizza=pepperoni ) (Person⋈ Eats ))

Find all pizzerias that serve at least one pizza that Amy eats for less than

$10.00.

e.

π pizzeria(σname=Amy∧ price<10 (Eats⋈Serves ))

Find all pizzerias that are frequented by only females or only males.

f.

π pizzeria(σ gender=M (Frequents⋈Person ))∪π pizzeria(σgender= F (Frequents⋈Person ))

For each person, find all pizzas the person eats that are not served by any

pizzeria the person frequents. Return all such person (name) / pizza pairs.

g.

Eats−πname−pizza (Frequents⋈Serves ) ¿

Find the names of all people who frequent only pizzerias serving at least one

pizza they eat.

h.

πname (Person)−πname (Frequents−πname−pizzeria (Eats⋈Serves ) )Find the names of all people who frequent every pizzeria serving at least one

pizza they eat.

πname (Person)−πname (πname−pizzeria (Eats⋈Serves )−Frequents )

i.Find the pizzeria serving the cheapest pepperoni pizza. In the case of ties, return

all of the cheapest-pepperoni pizzerias.

π pizzeria (σ pizza=pepperoni (Serves ) )−π pizzeria ¿