2016-02-25 163 views
0

我正在創建一個數據庫來建模一個在線快遞系統。 這些是我創建的表格。 表Vehicle發生錯誤。我怎樣才能解決這個問題?創建表時出現錯誤1604 MySQL

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

什麼是你得到的錯誤?請用它更新你的問題。 – aribeiro

回答

0

錯單引號,應該是:

vtype enum('T','B','P') NOT NULL 
+0

謝謝,我從來沒有注意到引號! :) – Shehzaan