select deptno,concat((count(empno)/(select count(empno) from emp))*100,'%') 人数占比
from emp
group by deptno #前三句是查询语句
into outfile 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/t1.csv'
fields terminated by ','
lines terminated by '\r\n'; #后三句是保存语句(只能保存到安全路径)
# '\r\n'回车分隔符;'\t\n'Tab分隔符