how2j自学仿天猫springboot版踩坑记录之建数据库-数据库关键字不能做表名

做该项目的第一天,开始建表,以下是我写的sql语句

create table order(
	id int(11) not null auto_increment,
  	orderCode varchar(255) default null,
	address varchar(255) default null,
	post varchar(255) default null,
	receiver varchar(255) default null,
	mobile varchar(11) default null,
	userMessage varchar(255) default null,
	createDate datetime default null,
	payDate datetime default null,
	deliveryDate datetime default null,
	confirmDate datetime default null,
	status varchar(255) default null,
	uid int(11) default null,
 	primary key(id),
	constraint fk_order_user foreign key(uid) references user(id)
)engine=InnoDB default charset=utf8;

`执行后一直报错:``
[Err] 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 ‘order(
id int(11) not null,
address varchar(255) default null,
post varcha’ at line 1
错误原因是order是关键字,不能做表名,改为order_就行了。

你可能感兴趣的:(java入门小白,新人踩坑记录)