MySQL Select into outfile用于导出指定的查询数据到文件
1.
导出表中所有ip数据到D盘根目录outfile.txt中
select ip into outfile 'd:/outfile.txt' from log;
2.
导出表中所有数据到D盘根目录outfile.txt中
select * into outfile 'd:/outfile.txt'
fields terminated by ','
from log;
再导回到数据库中
load data infile 'd:/outfile.txt' into table log fields terminated by ',' lines terminated by '\n'
2.
MYSQL不支持
Select * Into new_table_name from old_table_name
替代方法:
Create table new_table_name (Select * from old_table_name);