Mysql reports an error when creating a table. I can’t understand it after checking the manual. Can you please give me a solution?
create table abc(
id int unsigned primary_key auto_increment,
usename char(20) not null default '',
gender char(1) not null default '',
weight tinyint unsigned not null default 0,
birth date not null default 0,
salary decimal(8,2) not null default '000000.00',
lastlogin timestamp not null default 0,
intro varchar(1500) not null default '',
)engine myisam charset=utf8;
Error report: 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 'primary_key auto_increment,username char(20) not null default '',gender c' at line 3
Creating an indexed database table requires adding back-quotes to the table name and attributes, and the position of your current
primary key
needs to be adjusted:I just tried it. Except for
primary key
, other attributes and table names can be used without back-quotes. Even this is also possible:The declaration of primary_key is wrong, please solve it upstairs