I blogged it to remember.
load data infile 'aa.csv' into table tbl_name
character set 'UTF8'
fields terminated by ',' optionally enclosed by '"' escaped by '\\'
lines terminated by '\r\n' starting by ''
ignore 1 lines
(col1, col2, col3)
;
(col1, col2, col3)
;
case 2: when number of column of table and csv data
1- when you want drop some column of csv. ( drop v4, v5)
ex) csv contents : v1, v2, v3, v4, v5
load data infile 'aa.csv' into table tbl_name
character set 'UTF8'
fields terminated by ',' optionally enclosed by '"' escaped by '\\'
lines terminated by '\r\n' starting by ''
ignore 1 lines
(col1, col2, col3, @dummy1, @dummy2) -- @dummy just read and drop
(col1, col2, col3, @dummy1, @dummy2) -- @dummy just read and drop
댓글 없음:
댓글 쓰기