字节-数据分析师题-2022-05-29,求大牛爆破!

1.请使用SQL根据以下3个数据库表进行数据查询

audit_log

staff_info

category_dict

1)为了探究不同来源的审核内容质量是否存在差异,请查询每个来源的审核通过率(通过率=通过量/(通过量+拒绝量))
2)为了筛选效率高的同学给其他同学做经验分享,请查询近一周平均审核时长(审核时长=审核完成时间-开始审核时间)最短的5名员工的工号、姓名和部门,并根据平均审核时长降序排列
3)为了对部门进行激励提高业务承载量级,请查询部门最近两个月里每个月的人均审核量和部门人均审核量的月环比增长率
4)为了探究不同姓氏之间在工作产出量级方面有没有差异,现需对每个姓氏审核量级最高的同学做访谈,请查询上个月每个姓氏(默认均为单字姓氏,比如“赵”、“孙”)的人均日审核量并找出每个姓氏里审核量级最高的同学工号和姓名。

2、请从数据库表ods_audit_log中提取数据字段,输出结果如表dwd_audit_info(无语言种类限制)

ods_audit_log

dwd_audit_info
附某个data的结构

#字节商业产品面经5月产品面试复盘总结##笔试题目##内推#
全部评论
select category_name,sum(if(status=1,1,0))/sum(if(status>0,1,0)) pass_rate from audit_log join category_dict on audit_log.object_category=category_dict.category group by object_category select auditor_staff_id,staff_name,department_name from( select auditor_staff_id,avg(creat_time-star_time) avg_time from from audit_log group by auditor_staff_id order by avg_time limit 5) t1 join staff_info on audit_log.auditor_staff_id=staff_info.staff_id order by avg_time desc SELECT m,first(department_name),avg_audit, (avg_audit-last_mon)/last_mon growth_rate  from( select *, lag(avg_audit,1) over() last_mon  from( select from_unixtime(star_time,'%m&(30713)#39;) m,department_name count(1)/count(distinct auditor_staff_id) avg_audit form audit_log join staff_info on audit_log.auditor_staff_id=staff_info.staff_id group by m,department_id having m in(7,8)) t1) t2
1
送花
回复
分享
发布于 2022-08-19 23:45 四川
学到了,感谢分享啊
点赞
送花
回复
分享
发布于 2022-06-03 16:37
滴滴
校招火热招聘中
官网直投
后面那个题用pandas循环遍历就行了,比较简单。
点赞
送花
回复
分享
发布于 2022-08-19 23:50 四川
select surname,avg_audit,auditor_staff_id,staff_name from( select substr(staff_name,1,1) surname, count(1)/(count(distinct auditor_staff_id)*31) avg_audit form audit_log join staff_info on audit_log.auditor_staff_id=staff_info.staff_id where from_unixtime(star_time,'%m')=7 group by surname) t1 join ( select surname,staff_name,auditor_staff_id from( select surname,staff_name,auditor_staff_id, rank() over( partition by surname order by audit_count desc ) ranking from( select substr(first(staff_name),1,1) surname,first(staff_name),auditor_staff_id,count(1) audit_count from audit_log join staff_info on audit_log.auditor_staff_id=staff_info.staff_id where from_unixtime(star_time,'%m')=7 group by auditor_staff_id) t1) t2 where ranking =1 ) t2 using(surname)
点赞
送花
回复
分享
发布于 2022-08-20 01:34 四川

相关推荐

4 97 评论
分享
牛客网
牛客企业服务