我一直收到以下错误。
第3行的错误1064(42000):您的SQL语法出错; 检查与您的MySQL服务器版本对应的手册 正确的语法在'
附近使用
Species_ID int,
Genus varchar,
Species varchar,
Common_Name varchar,
Indiv' at line 9
hbm248@i6[datasets]$
以下是完整的SQL脚本:
DROP TABLE IF EXISTS paplants;
CREATE TABLE paplants (
ID int NOT NULL AUTO_INCREMENT,
Observation_ID int NOT NULL,
Update_Datetime int NOT NULL,
Site_ID int NOT NULL,
Latitude decimal NOT NULL,
Longitude decimal NOT NULL,
Elevation_in_Meters int,
`State` varchar,
Species_ID int,
Genus varchar,
Species varchar,
Common_Name varchar,
Individual_ID int,
Phenophase_ID int,
Phenophase_Description varchar,
Observation_Date date,
Day_of_Year int,
Phenophase_Status int,
PRIMARY KEY(ID)
);
LOAD DATA LOCAL INFILE "observation_data.csv"
INTO TABLE paplants
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(ID, Observation_ID, Update_Datetime, Site_ID, Latitude, Longitude, Elevation_in_Meters, `State`, Species_ID, Genus, Species, Common_Name, Individual_ID, Phenophase_ID, Phenophase_Description, Observation_Date, Day_of_Year, Phenophase_Status);
任何帮助都 真的 赞赏!
答案 0 :(得分:0)
您需要为varchar字段指定长度。即:varchar(10)
表示最大长度为10的varchar字段。