关于正向工程的mySQL错误1064

时间:2017-09-28 01:01:53

标签: mysql sql mysql-workbench mysql-error-1064

使用mySQL工作台,我创建了一个EER图表,并为我所在的类填充了适当的数据。这是产生问题的生成代码的示例:

DROP TABLE IF EXISTS `bhk13`.`person` ;

SHOW WARNINGS;
CREATE TABLE IF NOT EXISTS `bhk13`.`person` (
  `per_id` MEDIUMINT GENERATED ALWAYS AS () VIRTUAL,
  `per_fname` VARCHAR(15) NOT NULL,
  `per_lname` VARCHAR(30) NOT NULL,
  `per_city` VARCHAR(45) NOT NULL,
  `per_state` CHAR(2) NOT NULL,
  `per_street` VARCHAR(45) NOT NULL,
  `per_zip` INT NOT NULL,
  `per_phone` BIGINT NOT NULL,
  `per_email` VARCHAR(100) NOT NULL,
  `per_ssn` INT UNSIGNED NOT NULL,
  `per_gender` ENUM('m', 'f', 'o') NOT NULL,
  `per_dob` DATE NOT NULL,
  `per_is_emp` ENUM('y', 'n') NOT NULL,
  `per_is_alm` ENUM('y', 'n') NOT NULL,
  `per_is_stu` ENUM('y', 'n') NOT NULL,
  `per_note` VARCHAR(255) NULL,
  PRIMARY KEY (`per_id`))
ENGINE = InnoDB;

SHOW WARNINGS;

当我尝试对数据库进行转发工程时,会产生以下错误:

Thread started
Executing SQL script in server
ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VIRTUAL,
  `per_fname` VARCHAR(15) NOT NULL,
  `per_lname` VARCHAR(30) NOT NUL' at line 2
SQL Code:
        CREATE TABLE IF NOT EXISTS `bhk13`.`person` (
          `per_id` MEDIUMINT GENERATED ALWAYS AS () VIRTUAL,
          `per_fname` VARCHAR(15) NOT NULL,
          `per_lname` VARCHAR(30) NOT NULL,
          `per_city` VARCHAR(45) NOT NULL,
          `per_state` CHAR(2) NOT NULL,
          `per_street` VARCHAR(45) NOT NULL,
          `per_zip` INT NOT NULL,
          `per_phone` BIGINT NOT NULL,
          `per_email` VARCHAR(100) NOT NULL,
          `per_ssn` INT UNSIGNED NOT NULL,
          `per_gender` ENUM('m', 'f', 'o') NOT NULL,
          `per_dob` DATE NOT NULL,
          `per_is_emp` ENUM('y', 'n') NOT NULL,
          `per_is_alm` ENUM('y', 'n') NOT NULL,
          `per_is_stu` ENUM('y', 'n') NOT NULL,
          `per_note` VARCHAR(255) NULL,
          PRIMARY KEY (`per_id`))
        ENGINE = InnoDB

SQL script execution finished: statements: 9 succeeded, 1 failed

Fetching back view definitions in final form.
Nothing to fetch

导致此问题的原因是什么?如何解决?所有数据都是一致的

0 个答案:

没有答案