sql - mySQL AUTO_INCREMENT column creation -


i'm trying make simple database since yesterday primary id key auto_increment option keep getting error:

executing: create table `spring`.`samochod` ( `idsamochod` int not null default auto_increment, primary key (`idsamochod`));  operation failed: there error while applying sql script database. error 1064: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'auto_increment, primary key (`idsamochod`))' @ line 2 sql statement: create table `spring`.`samochod` (   `idsamochod` int not null default auto_increment,   primary key (`idsamochod`))  error 1064: have error in sql syntax; check manual corresponds mysql server version right syntax use near 'auto_increment, primary key (`idsamochod`))' @ line 2 

sql statement:

create table `spring`.`samochod` (   `idsamochod` int not null default auto_increment,   primary key (`idsamochod`)) 

i getting error normal integer columns. have read many articles before , far understand should work way without problems.

could tell me i'm doing wrong?

the problem not auto_increment default before it. no value has been specified default. remove default keyword not needed here.

see create table syntax in mysql documentation, specifically:

column_definition:     data_type [not null | null] [default default_value]       [auto_increment] [unique [key] | [primary] key]       [comment 'string']       [column_format {fixed|dynamic|default}]       [storage {disk|memory|default}]       [reference_definition] 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -