MySQL错误1604附近')NOT NULL,)'在第1行

时间:2014-04-09 22:35:33

标签: mysql

mysql> USE bitcoin;
Database changed
mysql> CREATE TABLE btc ( uuid VARCHAR(36) NOT NULL, ign VARCHAR(20) NOT NULL, btc DOUBLE(30) NOT NULL, ) ENGINE=InnoDB;
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 ') NOT NULL, ) ENGINE=InnoDB' at line 1
mysql> CREATE TABLE btc ( uuid VARCHAR(36) NOT NULL, ign VARCHAR(20) NOT NULL, btc DOUBLE(30) NOT NULL, );
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 ') NOT NULL, )' at line 1
mysql> CREATE TABLE btc ( uuid VARCHAR(36) NOT NULL, ign VARCHAR(20) NOT NULL, btc DOUBLE(30) NOT NULL, );

在Debian上使用MYSQL命令行时会抛出此错误。我正在尝试创建一个具有给定值的表。

mysql> CREATE TABLE btc ( uuid VARCHAR(36) NOT NULL, ign VARCHAR(20) NOT NULL, btc DOUBLE(30) NOT NULL);
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 ') NOT NULL)' at line 1
mysql>

也不起作用。

2 个答案:

答案 0 :(得分:0)

btc DOUBLE(30) NOT NULL, ) ENGINE=InnoDB;
                       ^

摆脱这个逗号

答案 1 :(得分:0)

在每个,语句的最后一个NOT NULL和右括号之间有一个额外的CREATE TABLE,而DOUBLE(30)上的一个宽度说明符我没有mysql> CREATE TABLE btc ( uuid VARCHAR(36) NOT NULL, ign VARCHAR(20) NOT NULL, btc DOUBLE(30) NOT NULL, ) ENGINE=InnoDB; ^^^^ ^ 。相信是有效的:

btc DOUBLE NOT NULL) ENGINE=InnoDB;

删除它,因此声明的结尾是{{1}}。