Question: create table Promotion ( PromoID char ( 3 ) not null , PromoName varchar ( 5 0 ) not null, PromoDiscount decimal ( 4 ,

create table Promotion(
PromoID char(3) not null ,
PromoName varchar(50) not null,
PromoDiscount decimal(4,1) not null,
primary key(PromoID)
);
create table Category (
CategoryID char(5) not null,
CategoryName varchar(50) not null,
CategoryDesc varchar(200) not null,
primary key(CategoryID)
);
create table Chocolate (
ChocolateID char(6) not null,
ChocolateName varchar(50) not null,
ChocolateDesc varchar(200) not null,
ChocolatePrice decimal (5,2) not null,
ChocolateWeight INT not null,
primary key(ChocolateID),
foreign key (CategoryID) references Category(CategoryID)
);
create table Discount (
PromotionID char(3) not null,
ChocolateID char(6) not null,
StartDate DATETIME not null,
EndDate DATETIME not null,
primary key (PromotionID, ChocolateID),
foreign key (ChocolateID) references Chocolate(ChocolateID),
foreign key (PromotionID) references Promotion(PromotionID)
);
Create table Customer (
CustomerID char(6) not null,
CustomerName varchar(70) not null,
CustomerEmail varchar(100) not null,
CustomerPhNum varchar(32) not null,
primary key(CustomerID)
);
Create table Review (
ReviewID char(6) not null,
ReviewRating decimal (2,0) not null,
ReviewComment varchar(255) not null,
ReviewDate DATETIME not null,
primary key (ReviewID),
foreign key (ChocolateID) references Chocolate(ChocolateID),
foreign key (CustomerID) references Customer(CustomerID)
);
-- Once successfully implemented, these insert statements should work.
INSERT INTO Promotion VALUES
('P01', "Opening Sale", 50.0);
INSERT INTO Category VALUES
('CAT01', "Ecuador Single Origin", "Cocoa beans from a single Ecuadorian source");
INSERT INTO Chocolate VALUES
('CHOC13', "Dark Chocolate Tablet", "Small, bite sized dark chocolate tablets", 17.99,80, 'CAT01');
INSERT INTO Discount VALUES
('P01', 'CHOC13','2023-02-0108:00:00','2023-02-0218:00:00');
INSERT INTO Customer VALUES
('CUS145', "Jon Snow", "j.snow@notreal.com", "90861923");
INSERT INTO Review VALUES
('REV131',8, "A delicious milk chocolate", '2023-02-0213:22:54', 'CUS145','CHOC13');

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!