Question
Can you correct the syntax on my database so it works ondbfiddle with mySQL CREATE TABLE Supplier ( SupplierID int PRIMARY KEY, DeliveryDate date, DeliveryID
Can you correct the syntax on my database so it works ondbfiddle with mySQL
CREATE TABLE Supplier
(
SupplierID int PRIMARY KEY,
DeliveryDate date,
DeliveryID int,
FOREIGN KEY (DeliveryID) REFERENCES Delivery(DeliveryID),
FOREIGN KEY (DeliveryDate) REFERENCES Delivery(DeliveryDate)
);
CREATE TABLE Order
(
OrderID int PRIMARY KEY,
OrderDate date,
HeadquartersID int,
HeadquartersID int FOREIGN KEY REFERENCESHeadquarters(HeadquartersID)
);
CREATE TABLE OrderDetail
(
OrderDetailID int PRIMARY KEY,
(ProductID) FOREIGN KEY REFERENCES Product(ProductID),
(OrderID) FOREIGN KEY REFERENCES orderr(OrderID),
OrderID int,
ProductID int,
ProductQuantity int
);
CREATE TABLE Product
(
ProductID int PRIMARY KEY,
SupplierID int,
FOREIGN KEY (SupplierID) REFERENCES Supplier(SupplierID)
);
CREATE TABLE OrderDeliveryDetail
(
DeliveryID int,
FOREIGN KEY (DeliveryID) REFERENCES Delivery(DeliveryID),
OrderID int FOREIGN KEY REFERENCES Order(OrderID),
OrderDetail varchar(50)
);
CREATE TABLE Headquaters
(
HeadquatersID int,
BranchID int,
FOREIGN KEY (BranchID)REFERENCES Branch(BranchID)
);
CREATE TABLE Branch
(
BranchID int PRIMARY KEY
);
CREATE TABLE Delivery
(
DeliveryID int PRIMARY KEY,
DeliveryDate date,
SupplierID int FOREIGN KEY REFERENCES Supplier(SupplierID)
);
Schema Error: Error: ER_CANNOT_ADD_FOREIGN: Cannot add foreign key constraint Schema Error: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Order (OrderID int PRIMARY KEY, OrderDate date, HeadquartersID int, Headquarter' at line 1 Schema Error: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(ProductID) FOREIGN KEY REFERENCES Product(ProductID), (OrderID) FOREIGN KEY REF' at line 3 Schema Error: Error: ER_CANNOT_ADD_FOREIGN: Cannot add foreign key constraint Schema Error: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FOREIGN KEY REFERENCES Order(OrderID), OrderDetail varchar(50) )' at line 4 United Kingdom. Schema Error: Error: ER_CANNOT_ADD_FOREIGN: Cannot add foreign key constraint Terms of Use Privacy/Cookie Policy Status 200 Ltd 201 Schema Error: Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FOREIGN KEY REFERENCES Supplier(SupplierID) )' at line 4
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started