DBMS : MySql

Database 2012. 9. 25. 11:27 Posted by Jay Choi

mysql 결과로 csv파일 생성

 

SELECT *

INTO OUTFILE "/tmp/result.csv"

FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'

LINES TERMINATED BY "\n"

FROM table;

 

txt 파일을 mysql에 로드

 

LOAD DATA INFILE '[filename]'

INTO TABLE [tablename]

FIELDS TERMINATED BY '\r' ENCLOSED BY '\r\n' ESCAPED BY '\\' LINES TERMINATED BY '\r\n' ([columnname], ...);

댓글을 달아 주세요