I get this error when trying to compile in sqlfiddle- 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 ')' at line 9
If I take Line 9 out it does the same, I'm not sure how to fix this.
I'm pretty new to this, can I run these commands from the community edition of MySQL?
If I run the customer table by itself it works, I add the Pizza table it's fine, but when I add the OrderInformation table is where I start getting that error. I've gone through the code a few times, is there something I'm missing when it comes to the orderinformation table? I'm Stuck.
CREATE TABLE Customer
(
CustomerID int NOT NULL AUTO_INCREMENT,
FirstName varchar(45) NOT NULL,
LastName varchar(45) NOT NULL,
StreetAddress varchar(45) NOT NULL,
City varchar(45) NOT NULL,
State varchar(2) NOT NULL,
ZipCode varchar(5) NOT NULL,
HomePhone INT(11) ,
MobilePhone INT(11) ,
OtherPhone INT(11),
PRIMARY KEY (CustomerID)
);
CREATE TABLE Pizza
(
PizzaID INT NOT NULL AUTO_INCREMENT,
PizzaName VARCHAR(45) NOT NULL,
Description VARCHAR(90),
UnitPrice DECIMAL NOT NULL,
PRIMARY KEY (PizzaID)
);
CREATE TABLE OrderInformation
(
OrderID int NOT NULL,
CustomerID int NOT NULL AUTO_INCREMENT,
OrderDate date NOT NULL,
PRIMARY KEY (CustomerID, OrderID),
FOREIGN KEY(CustomerID) REFERENCES Customer (CustomerID),
);
CREATE TABLE OrderItem
(
OrderID INT NOT NULL,
Quantity SMALLINT(5),
PizzaID INT NOT NULL,
PRIMARY KEY (OrderID, PizzaID),
FOREIGN KEY(PizzaID) REFERENCES Pizza (PizzaID),
FOREIGN KEY(OrderID) REFERENCES OrderInformation (OrderID)
);