我正在创建一个数据库来建模在线快递系统。
这些是我正在创建的表。
表Vehicle
发生错误。我怎样才能解决这个问题?
CREATE TABLE Customer
(
cid int(7) NOT NULL,
cfname char(25) NOT NULL,
clname char(25) NOT NULL,
aptnum int(100) NOT NULL,
street char(50) NOT NULL,
pobox int(10) NOT NULL,
area char(50) NOT NULL,
country char(50) NOT NULL,
phone int(12) NOT NULL,
PRIMARY KEY (cid)
)ENGINE=INNODB;
CREATE TABLE Orderr
(
orderid int(8) NOT NULL,
origin char(100) NOT NULL,
destination char(100) NOT NULL,
eta date NOT NULL,
weight int(100) NOT NULL,
priority enum('F','R') NOT NULL,
task enum('P','D') NOT NULL,
odate date NOT NULL,
cnum int(12) NOT NULL,
cpin int(8) NOT NULL,
custid int(7) NOT NULL,
PRIMARY KEY (orderid),
FOREIGN KEY (custid) REFERENCES Customer(cid)
)ENGINE=INNODB;
CREATE TABLE History
(
histid int(6) NOT NULL,
orderid int(8) NOT NULL,
status enum('D','O','R') NOT NULL,
current_loc char(50) NOT NULL,
PRIMARY KEY(histid),
FOREIGN KEY (orderid) REFERENCES Orderr(orderid)
)ENGINE=INNODB;
CREATE TABLE Driver
(
driverid int(6) NOT NULL,
dfname varchar(25) NOT NULL,
dlname varchar(25) NOT NULL,
dob date NOT NULL,
phone int(10) NOT NULL,
vehicle int(6) NOT NULL,
PRIMARY KEY (driverid)
)ENGINE=INNODB;
CREATE TABLE Vehicle
(
vid int(6) NOT NULL,
num_plate varchar(6) NOT NULL,
vtype enum(’T’,’B’,’P’) NOT NULL,
driverr int(6) NOT NULL,
orders int(8) NOT NULL,
PRIMARY KEY (vid),
FOREIGN KEY (driverr) REFERENCES Driver(driverid),
FOREIGN KEY (orders) REFERENCES Orderr(orderid)
)ENGINE=INNODB;
谢谢!
答案 0 :(得分:0)
枚举值的单引号错误应为:
vtype enum('T','B','P') NOT NULL