开发者

Tool for importing CSV files into MySQL database? [closed]

开发者 https://www.devze.com 2023-02-07 12:35 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Cl开发者_如何学Cosed 10 years ago.

I've got several CSV files I want to import into a table. They all contain different numbers of columns, so some data will be absent during each import. I need a tool that will let me map which CSV column goes into which MySQL column. Doesn't look like MySQL workbench can do this. What else can I use?


MySQL has the LOAD DATA INFILE syntax:

LOAD DATA INFILE 'data.txt' INTO TABLE tbl_name
 FIELDS TERMINATED BY ',' ENCLOSED BY '"'
 LINES TERMINATED BY '\r\n'
 IGNORE 1 LINES;

See the documentation about custom data handling.


If you're running on a Mac, Sequel Pro is pretty good for this sort of thing (as long as you import each CSV file individually).

http://www.sequelpro.com/

0

精彩评论

暂无评论...
验证码 换一张
取 消