当前位置: 移动技术网 > IT编程>数据库>Mysql > SQL执行错误#1064---保留字错误

SQL执行错误#1064---保留字错误

2018年11月28日  | 移动技术网IT编程  | 我要评论
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:
如果您觉得我的文章对您有帮助,可以扫码领取下红包,谢谢!

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网