我正在尝试创建表但它向我显示2个错误,我如何解决它?

时间:2017-07-05 14:48:27

标签: sql

在分析过程中发现了2个错误。

  

声明开始意外。 (位置349处的“admin_id”附近)   无法识别的语句类型。 (位置358附近的“INT”)

CREATE TABLE Users (
  user_id INT NOT NULL AUTO_INCREMENT,
  email VARCHAR(80) NOT NULL,
  password CHAR(41) NOT NULL,
  name VARCHAR(50) NOT NULL,
  phone VARCHAR(20) NOT NULL,
  gender VARCHAR(6) NOT NULL,
  fbinfo  VARCHAR(50) NOT NULL,
  age INT NOT NULL,
  PRIMARY KEY (user_id),
  UNIQUE INDEX (email)
)

CREATE TABLE Admin (
  admin_id INT NOT NULL AUTO_INCREMENT,
  email VARCHAR(80) NOT NULL,
  password CHAR(41) NOT NULL,
  PRIMARY KEY (admin_id),
  UNIQUE INDEX (email)
) 

CREATE TABLE Task (
  task_id INT NOT NULL AUTO_INCREMENT,
  tex VARCHAR(140) NOT NULL,
  datetime DATE,
  status INT,
  calendar BOOLEAN,
  PRIMARY KEY (task_id),
  lat DECIMAL(9,6),
  long DECIMAL(9,6)
)

1 个答案:

答案 0 :(得分:1)

如果您在一次执行中执行此操作,则需要在每个表创建语句的末尾包含;

CREATE TABLE Users (
  user_id INT NOT NULL AUTO_INCREMENT,
  email VARCHAR(80) NOT NULL,
  password CHAR(41) NOT NULL,
  name VARCHAR(50) NOT NULL,
  phone VARCHAR(20) NOT NULL,
  gender VARCHAR(6) NOT NULL,
  fbinfo  VARCHAR(50) NOT NULL,
  age INT NOT NULL,
  PRIMARY KEY (user_id),
  UNIQUE INDEX (email)
);

CREATE TABLE Admin (
  admin_id INT NOT NULL AUTO_INCREMENT,
  email VARCHAR(80) NOT NULL,
  password CHAR(41) NOT NULL,
  PRIMARY KEY (admin_id),
  UNIQUE INDEX (email)
);

CREATE TABLE Task (
  task_id INT NOT NULL AUTO_INCREMENT,
  tex VARCHAR(140) NOT NULL,
  datetime DATE,
  status INT,
  calendar BOOLEAN,
  PRIMARY KEY (task_id),
  lat DECIMAL(9,6),
  long DECIMAL(9,6)
);