Unable create a table - ERROR 1064 (42000): You have an error in your SQL syntax

亡梦爱人 提交于 2019-12-11 07:23:49

问题


I'm trying to execute this simple command:

create table foo
(clo int primary key unsigned auto_increment);

But I get this error:

ERROR 1064 (42000): 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 'unsigned auto_increment)' at line 2


回答1:


I tried putting int and unsigned together and it worked fine:

create table foo
(clo int unsigned primary key auto_increment );



回答2:


Your syntax is a little off. Try this:

create table `foo` (
  `clo` int unsigned auto_increment ,
  PRIMARY KEY(`clo`)
) ENGINE=MYISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;


来源:https://stackoverflow.com/questions/2758649/unable-create-a-table-error-1064-42000-you-have-an-error-in-your-sql-syntax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!