CREATE TABLE ORDER( Order_id INT PRIMARY KEY AUTO_INCREMENT,
Total_price FLOAT NOT NULL,
Item_Serial_number INT NOT NULL,
Num_of_items INT NOT NULL,
Cust_username VARCHAR(25) NOT NULL,
Date_placed DATE NOT NULL,
Date_arrived DATE,
Cust_cart INT NOT NULL,
FOREIGN KEY(Cust_cart) REFERENCES CART(Cart_id),
FOREIGN KEY(Item_Serial_number) REFERENCES ITEM(Serial_number),
FOREIGN KEY(Cust_username) REFERENCES USER(Username));
Asked
Active
Viewed 761 times
-1

Bill Karwin
- 538,548
- 86
- 673
- 828

user7356652
- 3
- 1
-
You can't use reserved words as table names without quoting them – miken32 Mar 06 '18 at 23:42
1 Answers
0
As mentioned in comments, you should try CREATE TABLE "ORDER"
as order
is a term with meaning in SQL and needs to be quoted if you want to use it as a name. Better yet, don't use a reserved word as your table name (as this is confusing to other users) and call it something along the lines of PRODUCT_ORDERS

Pdubbs
- 1,967
- 2
- 11
- 20