Culture, IT, Trend, Travel , Experience korea travel & culture youtube: https://www.youtube.com/@kawadakr
2013. 4. 1.
2013. 1. 28.
import csv into mysql by load data (skip some column)
It's very general , well known topic.but when we need time to find and use it.
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
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
피드 구독하기:
글 (Atom)
