创建一个表,表中列weight
带有括号
create table student(
id int auto_increment,
name varchar(20),
weight(kg) int,
primary key (id)
)engine=innodb;
会出现报错
对于带括号的列需要用反引号`
将其标记起来
create table student(
id int auto_increment,
name varchar(20),
`weight(kg)` int,
primary key (id)
)engine=innodb;
对于表中带括号的列的修改以及表的查询也是同样的做法
alter table students add `weight(kg)` int;
select `weight(kg)` from students;
版权声明:本文为m0_60352504原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。