我的是mysql5.7.請看下有什么錯,錯誤出在varchar(20)這一行
如上圖所示。
mysql> CREATE TABLE tb1(
? ? -> age TINYINT UNSIGNED,
? ? -> salary FLOAT(8,2) UNSIGNED
? ? -> );
這是可以的,但是
mysql> CREATE TABLE tb1(
? ? -> username VARCHAR(20),
? ? -> age TINYINT UNSIGNED,
? ? -> salary FLOAT(8,2) UNSIGNED
? ? -> );
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 '(20),
age TINYINT UNSIGNED,
salary FLOAT(8,2) UNSIGNED
)' at line 2
這就不行
mysql> CREATE TABLE tb2(
? ? -> username VARCHAR(20)
? ? -> );
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 '(20)
)' at line 2
這也不行,誰能幫我看下錯誤在哪?
2016-10-30
VARCHAR(20)前面的那個空格有問題,刪掉重新敲一下空格
2016-06-17
把VARCHAR(20)前面的Tab改成空格