我csv文件具有以下結構:如何將數據從CSV導入到MySQL?
A BA0011 U206 NAME 0000000000000149.00 000000.00 0000000000000118.93 S N N
A BB0011 U206 NAME 0000000000000150.00 000000.00 0000000000000118.93 S N N
A BC0011 U206 NAME 0000000000000151.00 000000.00 0000000000000118.93 S N N
A BD0011 U206 NAME 0000000000000152.00 000000.00 0000000000000118.93 S N N
A BE0011 U206 NAME 0000000000000153.00 000000.00 0000000000000118.93 S N N
使用下面的MySQL功能如何,我可以在MySQL表中導入第一和第三列:
LOAD DATA INFILE 'data.csv' INTO TABLE tbl_name
FIELDS TERMINATED BY \t' ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
我爲我的英語道歉!
在此先感謝!
請參閱CSV存儲引擎http://dev.mysql.com/doc/refman/5.6/en/csv-storage-engine.html以獲得更多樂趣。 – biziclop 2012-03-04 13:54:58