```sql CREATE TABLE IF NOT EXISTS ( INT NOT NULL AUTO_INCREMENT, VARCHAR(45) NOT NULL, VARCHAR(2048) NULL, VARCHAR(45) NOT NULL, TIMESTAMP NOT NULL DE ...
CREATE TABLE IF NOT EXISTS `change` (
`id` INT NOT NULL AUTO_INCREMENT,
`creator` VARCHAR(45) NOT NULL,
`description` VARCHAR(2048) NULL,
`supervisor` VARCHAR(45) NOT NULL,
`created_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`planed_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`executor` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
以上為change
的建表語句.
insert into change (creator, description, supervisor, executor) values ('1111', '1', '111', '111');
執行以上insert
操作時,報SQL執行錯誤 #1064
錯誤.
誤以為時sql
語句書寫錯誤,檢查良久之後確認無誤.
突然聯想到change
可能是mysql
保留字,網上搜索後驗證猜想.
因此,對change
保留字添加反引號解決.
insert into `change` (creator, description, supervisor, executor) values ('1111', '1', '111', '111');
PS:
如果您覺得我的文章對您有幫助,可以掃碼領取下紅包,謝謝!