Here's the script:
create table Customer
(
CustomerId int primary key identity(1,1),
Name nvarchar(64) not null,
LastName nvarchar(256) not null,
Telephone nvarchar(32),
MobilePhone nvarchar(32),
Address nvarchar(256)
)
create table Product
(
ProductId int primary key identity(1,1),
Name nvarchar(64),
Price decimal
)
create table StoreOrder
(
StoreOrderId int primary key identity(1,1),
Date datetime,
CustomerId int foreign key references Customer(CustomerId),
Total decimal
)
create table ProductStoreOrder
(
ProductStoreOrderId int primary key identity(1,1),
StoreOrderId int foreign key references StoreOrder(StoreOrderId),
ProductId int foreign key references Product(ProductId),
Quantity int
)
I'm confused on how to handle toppings. I should be able to add toppings in the database somewhere and create pizzas with N toppings, each topping should also have an associated price.
I could create a Toppings table and associate it to Product but not every product has a topping. For example, bread sticks, a diet soda, a salad, etc.
What would be the best way to handle this situation? Also, any comments on the database design so far?
Thank you for your time.