How to import CSV into mysql if values contains comma -
i've csv file values may have comma part of value
"09200, france, paris", "tower ""olivia""" "09200, spain, barselona", shop - perfect
however once import data breaks value on 4 columns (based on number of comma in row). do wrong? please see import command below.
load data local infile '~/downloads/file.csv' table my_table character set utf8 fields terminated ',' lines terminated '\n' (@col1,@col2) set address=@col1,name=@col2;
add enclosed by
clause query:
load data local infile '~/downloads/file.csv' table my_table character set utf8 fields terminated ',' optionally enclosed '"' lines terminated '\n' (@col1,@col2) set address=@col1,name=@col2;
Comments
Post a Comment