如何将CSV文件导入MySQL表
CREATE TABLE 'CSVImport' (id INT);ALTER TABLE CSVImport ADD COLUMN Title VARCHAR(256);ALTER TABLE CSVImport ADD COLUMN Company VARCHAR(256) ;ALTER TABLE CSVImport ADD COLUMN NumTickets VARCHAR(256);...ALTER TABLE CSVImport Date49 ADD COLUMN Date49 VARCHAR(256);ALTER TABLE CSVIm port Date50 ADD COLUMN Date50 VARCHAR(256);
LOAD DATA INFILE '/home/paul/clientdata.csv' INTO TABLE CSVImport;Query OK, 2023 rows affected, 65535 warnings (0.08 sec)Records: 2023 Deleted: 0 Skipped: 0 Warnings: 198256SELECT * FROM CSVImport;| NULL | NULL | NULL | NULL | NULL | ...
NULL
.
LOAD DATA
LOAD DATA INFILE "/home/paul/clientdata.csv"INTO TABLE CSVImport COLUMNS TERMINATED BY ','OPTIONALLY ENCLOSED BY '"'ESCAPED BY '"'LINES TERMINATED BY '\n'IGNORE 1 LINES;
NULL
拉丁的传说
相关分类