LukeHan 의 잡다한 기술 블로그

[MariaDB] Table Data Export to CSV File 본문

Database/Mysql

[MariaDB] Table Data Export to CSV File

LukeHan1128 2024. 7. 5. 20:00
반응형

 

DB Table to CSV File

SELECT `field1`, `field2`, `field3` INTO OUTFILE './filename.csv'
  FIELDS
    TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
  FROM table_name;

 

 

 

CSV File to DB Table

LOAD DATA INFILE './filename.csv'
  INTO TABLE table_name
  FIELDS
    TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
  (`field1`, `field2`, `field3`);

 

 

 

 

 

반응형
Comments