[英]MySql issues using ENGINE = INNODB
So first things first, below is my code.所以首先,下面是我的代码。 When I run this on my school's mysql server I get back ERROR 1005 (HY000).
当我在学校的 mysql 服务器上运行它时,我返回 ERROR 1005 (HY000)。 Although this error ONLY happens for the customers, orders, and odetails tables.
尽管此错误仅发生在客户、订单和 odetails 表中。 I do get a few warnings back.
我确实收到了一些警告。 From the research I have done this is being caused by me implementing innodb incorrectly.
根据我所做的研究,这是由于我错误地实施 innodb 造成的。 Any help would be much appreciated, especially since this is only one of the starting steps for this assignment.
任何帮助将不胜感激,特别是因为这只是此任务的开始步骤之一。
drop table IF EXISTS employees;
drop table IF EXISTS parts;
drop table IF EXISTS customers;
drop table IF EXISTS orders;
drop table IF EXISTS odetails;
drop table IF EXISTS zipcodes;
create table employees
(eno numeric(4,0),
ename varchar(15),
zip numeric(5,0),
hdate date default null,
primary key (eno),
foreign key (zip) references zipcodes (zip)
)ENGINE=InooDB;
create table parts
(pno numeric(5,0),
pname varchar(30),
qoh numeric(3,0),
price numeric(10,2),
level numeric(2,0),
primary key (pno)
)ENGINE=InnoDB;
create table customers
(cno numeric(4,0),
cname varchar(15),
street varchar(30),
zip numeric(5,0),
phone varchar(12),
primary key (cno),
foreign key (zip) references zipcodes (zip))
ENGINE=InnoDB;
create table orders
(ono numeric(4,0),
cno numeric(4,0),
eno numeric(4,0),
received date default null,
shipped date default null,
primary key (ono),
foreign key (cno) references customers (cno),
foreign key (eno) references employees (eno)
)ENGINE=InnoDB;
create table odetails
(ono numeric(4,0),
pno numeric(5,0),
qty numeric(1,0),
primary key (ono, pno),
foreign key (ono) references orders (ono),
foreign key (pno) references parts (pno)
)ENGINE=InnoDB;
create table zipcodes
(zip numeric(5,0),
city varchar(15),
primary key (zip)
)ENGINE=InnoDB;
1005 -- Declare the tables in the correct order based on the FOREIGN KEYs
. 1005 - 根据
FOREIGN KEYs
以正确的顺序声明表。 For example, do zipcodes
first.例如,先做
zipcodes
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.