Products with different prices and sizes
I am designing a database for a system for registering orders for a pizzeria, but a couple of problems arose:
I have a table called products that contains these attributes:
| PRODUCTS |
| --------------------- |
| id | int |
| name | varchar |
| description | varchar |
| url_image | varchar |
| price | decimal |
| size | varchar |
| published | boolean |
I had a problem with the price and the sizes so I normalized in 3 tables: Prices, Sizes and Products that should be related:
| PRODUCTS |
| --------------------- |
| id | int |
| name | varchar |
| description | varchar |
| url_image | varchar |
| published | boolean |
| SIZES |
| -------------- |
| id | int |
| size | varchar |
| PRICES |
| --------------- |
| id | int |
| value | decimal |
1 pizza can have different sizes such as personal, family, etc, each size of pizza has a certain price which is also affected by the taste of the pizza, for example 1 family size ham pizza can cost 10 dollars while 1 pizza Hawaiian of the same size can cost 15 dollars, you also have to take into account that a product can not only be a pizza but a soda or another that the business requires.
How can I relate these 3 tables? Or is it unnecessary to take price and size as entities?
Comments
Post a Comment