我有3张 table
客户、菜单和订单。
订单表假设连接了客户表和菜单表,并包含两者的主键。以下是我尝试在 phpmyadmin 上创建订单表的方法。
create table order(
customerID int not null,
itemID int not null,
primary key (customerID, itemID),
foreign key(customerID) reference customer(ID),
foreign key(itemID) reference menu(itemID)
)
这行不通。我做错了什么?!!
最佳答案
order
是保留字,换个名字试试,或者引用一下,比如
create table `order`(
customerID int not null,
itemID int not null,
primary key (customerID, itemID),
foreign key(customerID) reference customer(ID),
foreign key(itemID) reference menu(itemID) )
关于php - 创建连接表问题!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6234067/