我无法使用下面的SQL指令创建表
我试图修改一些默认值,但是我有同样的错误。
DROP TABLE IF EXISTS CountryLanguage;
CREATE TABLE CountryLanguage (
CountryCode TEXT NOT NULL DEFAULT '',
Lang TEXT NOT NULL DEFAULT '',
IsOfficial INTEGER NOT NULL DEFAULT '0',
Percentage NUMBER NOT NULL default '0.0',
PRIMARY KEY (CountryCode,Lang)
);
未创建表,并且我在下面显示消息:
Static analysis:
1 errors found during the scan.
Data type not recognized. (near "NUMBER" in position 164)
SQL request: CREATE TABLE CountryLanguage ( CountryCode TEXT NOT NULL DEFAULT '', Lang TEXT NOT NULL DEFAULT '', IsOfficial INTEGER NOT NULL DEFAULT '0', Percentage NUMBER NOT NULL default '0.0', PRIMARY KEY (CountryCode,Lang) )
MySQL replied: Documentation
# 1064 - Syntax error near 'NUMBER NOT NULL default' 0.0 ',
PRIMARY KEY (CountryCode, Lang)
) 'at line 5
答案 0 :(得分:1)
尝试一下:
DROP TABLE IF EXISTS CountryLanguage;
CREATE TABLE CountryLanguage (
CountryCode TEXT NOT NULL DEFAULT '',
Lang TEXT NOT NULL DEFAULT '',
IsOfficial INTEGER NOT NULL DEFAULT 0,
Percentage FLOAT NOT NULL default 0.0,
PRIMARY KEY (CountryCode,Lang)
);
另外,请注意您的常量数据-数字不带撇号(用于字符串)