Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Let’s say you run a pizza shop and you have a special where customers can get no

ID: 3906537 • Letter: L

Question

Let’s say you run a pizza shop and you have a special where customers can get no more than three toppings, and only one of each type:

one type of cheese one type of meat one type of vegetable

Toppings can only be of one type. So, in comes orders for the first two pizzas and they are stored in a table as shown.

Pizza

Type

Topping

1

cheese

mozzarella

1

meat

pepperoni

1

vegetable

olives

2

meat

mozzarella*

2

cheese

sausage *

2

vegetable

peppers

How does the relvar keep an anomaly of a pizza containing more than one topping type from occurring?

What anomaly is shown occurring with the relvar?

Restructure the relvar into smaller relvars to keep that anomaly from occurring also (i.e., preventing both types of anomalies). include all the primary keys.

Pizza

Type

Topping

1

cheese

mozzarella

1

meat

pepperoni

1

vegetable

olives

2

meat

mozzarella*

2

cheese

sausage *

2

vegetable

peppers

Explanation / Answer

Answer)

As per the question, customers can get no more than three toppings, and only one of each type:

one type of cheese

one type of meat

one type of vegetable

Thus there is only 1 topping for each pizza.

How does the relvar keep an anomaly of a pizza containing more than one topping type from occurring?

The pizza should be a primary key. I.E the pizza order number should be a primary key which would prevent the anomaly of selecting cheese, meat, vegetable for a pizza and three toppings for a pizza.

What anomaly is shown occurring with the relvar?

The anomaly which is occurring with the relvar is that he sees that there is one pizza but the type of the pizza is different in 3 columns and also the topping of the pizza is different in 3 columns. Thus this is an anomaly as 1 pizza should have only 1 type and 1 topping from one of each type:

one type of cheese

one type of meat

one type of vegetable

And there will be only 1 topping for each pizza.

Restructure the relvar into smaller relvars to keep that anomaly from occurring also (i.e., preventing both types of anomalies). include all the primary keys.

First of all for the table (Pizza, Type, Topping)

Pizza should be a Primary key.

This there will only be 1 unique pizza per table.

The Type can be either:

cheese

meat

vegetable

The Toppings can be either:

mozzarella

pepperoni

olives

sausage

So in case the customer wants more than 3 toppings in 1 pizza, the table can further be restructured as:

(Pizza, Type, Topping1, Topping2, Topping3)