使用Load命令将csv文件导入到mysql

2016-09-14 15:05:08   数据库

  mysql  

导入SQL

LOAD DATA infile 'e:/qy/order.csv' 
INTO TABLE mc_order 
fields terminated BY ',' 
enclosed BY '"'
lines terminated BY '\n'
IGNORE 1 ROWS (staff_no,
               order_no,
               client_no,
               take_name,
               remarks,
               tel,
               order_status,
               express_name,
               express_no,
               address,
               amount,
               buy_datetime
)

说明

load data infile "filepath" :从指定文件中载入数据

into table table_name :指定将数据插入到指定表中

fields terminated by ',' :列之间使用分隔符来分割

enclosed by '"' :字符串使用 " 进线包裹

lines terminated by '\n' :行记录结束标记

ignore 1 rows; :忽略第一行