DataWhale MySQL Task3 #2019-04-06

MySQL数据导出CSV

SELECT * FROM [TABLE]
INTO OUTFILE '[FILE]';

# 例如
SELECT * FROM mytable 
INTO OUTFILE '/tmp/mytable.csv'
FIELDS TERMINATED BY ',' 
OPTIONALLY ENCLOSED BY '"' 
LINES TERMINATED BY '\n';

MySQL数据导入CSV

LOAD DATA INFILE '[FILE]'
INTO TABLE [TABLE]
FIELDS TERMINATED BY ',' 
OPTIONALLY ENCLOSED BY '"' 
LINES TERMINATED BY '\n';

# 实例
LOAD DATA INFILE '/tmp/mytable.csv' 
INTO TABLE mytable 
FIELDS TERMINATED BY ',' 
OPTIONALLY ENCLOSED BY '"' 
LINES TERMINATED BY '\n';

你可能感兴趣的:(DataWhale MySQL Task3 #2019-04-06)