我是MySQL新手,我正在使用Workbench 6.3.9社区版运行5.7.19-log版本(至少这是我从命令行客户端得到的)。我的问题是我正在尝试使用UI创建一个带有自动生成id的简单表,但是当我执行生成的脚本时,它会抛出以下错误:
Operation failed: There was an error while applying the SQL script to the database.
Executing:
CREATE TABLE `travelportaldb`.`user` (
`user_id` INT GENERATED ALWAYS AS () VIRTUAL,
`name` VARCHAR(45) NOT NULL,
`account_id` VARCHAR(15) NULL,
`account_currency` CHAR(3) NULL,
`account_balance` DECIMAL NULL,
PRIMARY KEY (`user_id`));
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,
`name` VARCHAR(45) NOT NULL,
`account_id` VARCHAR(15) NULL,
`ac' at line 2
SQL Statement:
CREATE TABLE `travelportaldb`.`user` (
`user_id` INT GENERATED ALWAYS AS () VIRTUAL,
`name` VARCHAR(45) NOT NULL,
`account_id` VARCHAR(15) NULL,
`account_currency` CHAR(3) NULL,
`account_balance` DECIMAL NULL,
PRIMARY KEY (`user_id`))
这是它生成的脚本:
CREATE TABLE `travelportaldb`.`user` (
`user_id` INT GENERATED ALWAYS AS () VIRTUAL,
`name` VARCHAR(45) NOT NULL,
`account_id` VARCHAR(15) NULL,
`account_currency` CHAR(3) NULL,
`account_balance` DECIMAL NULL,
PRIMARY KEY (`user_id`));
我不知道出了什么问题。我来自oracle背景,查询似乎很好,除了自动生成的我不知道。
请帮忙。
感谢。