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));
答案 0 :(得分:0)
正如评论中所述,您应该尝试CREATE TABLE "ORDER"
,因为order
是一个在SQL中有意义的术语,如果您想将其用作名称,则需要引用它。更好的是,不要使用保留字作为您的表名(因为这会让其他用户感到困惑)并将其称为PRODUCT_ORDERS