这可能是一个非常简单的问题,但对于我来说,当我尝试将此 CSV 文件导入我的 SQL 表时,我看不到我缺少什么。
我一直以 0 结束我的 int 'idRefs',而我的日期 'dob' 则为 1969 年 12 月 31 日
警告示例:
| Warning | 1366 | Incorrect integer value: '
10002' for column 'idRef' at row 1 |
| Warning | 1265 | Data truncated for column 'dob' at row 1
LOAD DATA INFILE 语句——
mysql> LOAD DATA INFILE '/home/user/Documents/pplList.csv' INTO TABLE people
FIELDS TERMINATED BY ',' LINES TERMINATED BY '"' IGNORE 1 LINES
(idRef, lastName, firstName, dob, rsNum, slNum, firstVisit, pplPref, coachName);
只是 CSV 中的一些示例——
idRef,lastName,firstName,dob,rsNum,slNum,firstAppt,pplPref,coachName"
10001,BlankA,NameA,4/15/68,1000000,4600000,3/31/08,Positive,John Jay"
10002,BlankB,NameB,10/28/78,1000001,4600001,8/19/11,Positive,John Jay"
'people' 表 SQL 代码——
DROP TABLE IF EXISTS people;
CREATE TABLE people
(
id smallint unsigned NOT NULL auto_increment,
idRef int unsigned NOT NULL,
lastName varchar(255),
firstName varchar(255),
dob date NOT NULL,
rsNum int unsigned NOT NULL,
slNum int unsigned NOT NULL,
firstAppt date NOT NULL,
pplPref varchar(255),
coachName varchar(255),
PRIMARY KEY (id)
);