Mysql CSV load infile

前端 未结 2 873
广开言路
广开言路 2021-01-01 07:55

I\'ve got a CSV file with 9 columns and I have a MySQL table with 11 columns.

The CSV file looks like:

col1, col2, col3, col4, col5, col6, col7, col8         


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-01 08:25

    Looks like you can use LINES TERMINATED BY (perhaps with PHP_EOL).
    http://dev.mysql.com/doc/refman/5.0/en/load-data.html

    To quote the manual page:

    If a line does not contain all fields, the rest of the columns are set to their default values.

提交回复
热议问题