将TXT文件导入MySQL,统计重复数据

创建表

create table test(
id int
);

导入数据

load data  local infile “D:/test.txt”  
into table test(id); 

显示重复数据及其出现次数且以出现次数从大到小排序

select id, count(*)
from test
group by id 
order by count(*) desc;

导出数据

select * from table into outfile 'D:/test.txt'; 

猜你喜欢

转载自blog.csdn.net/qq_30019237/article/details/54286251
今日推荐