我有一个包含五列(id,name,age,number,email)的表,其中(列'id'是Pk并且具有auto_increment)和一个包含仅用于列的信息的单列csv
文件数'。如何在mysql
中加载此文件。
我试过这个但是没有用:
load data local infile 'C:/Users/user/Downloads/dnd_220116.csv'
into table testing FIELDS TERMINATED BY ','
ENCLOSED BY '"' LINES TERMINATED BY '\r\n' (@dummy,@dummy,number,@dummy);
答案 0 :(得分:0)
LOAD DATA LOCAL
INFILE 'C:\\Users\\<user_name>\\Downloads\\dnd_220116.csv'
INTO TABLE `<database_name>`.`testing` CHARACTER SET 'utf8'
FIELDS ESCAPED BY '\\'
TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
(`number`);