首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
基础学习课
实战项目课
求职辅导课
专栏&文章
竞赛
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
AI面试、笔试、校招、雇品
HR免费试用AI面试
最新面试提效必备
登录
/
注册
夏天就是今天
获赞
0
粉丝
0
关注
0
看过 TA
1
中国传媒大学
2024
数据分析师
IP属地:广东
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑夏天就是今天吗?
发布(21)
评论
刷题
收藏
夏天就是今天
关注TA,不错过内容更新
关注
02-25 19:38
已编辑
中国传媒大学 数据分析师
题解 | 获取所有非manager员工当前的薪水情况
select d.dept_no,c.emp_no,e.salary from (select a.emp_no,b.dept_no from (employees as a left join dept_manager as b on a.emp_no=b.emp_no) where b.dept_no is null) as c left join dept_emp as d on c.emp_no=d.emp_no left join salaries as e on c.emp_no=e.emp_no 一直卡在中间的第一个select,要尽量具体,还是找不到用*号的机会但其实还是想不明...
0
点赞
评论
收藏
分享
02-25 18:54
中国传媒大学 数据分析师
题解 | 统计各个部门的工资记录数
select c.dept_no,c.dept_name,count(a.emp_no) as sum from (salaries as a left join dept_emp as b on a.emp_no=b.emp_no left join departments as c on b.dept_no=c.dept_no) group by c.dept_no order by c.dept_no 主要是会卡在这个sum是用count函数来计算,另外不需要去重
0
点赞
评论
收藏
分享
02-25 18:33
中国传媒大学 数据分析师
题解 | 查找在职员工自入职以来的薪水涨幅情况
select n.emp_no,(n.salary-o.salary) as growth from ((select b.emp_no,b.salary from (employees as a right join salaries as b on a.emp_no=b.emp_no) where from_date=hire_date) as o right join (select emp_no,salary from salaries where to_date='9999-01-01') as n on o.emp_no=n.emp_no) order by growth o表是入...
0
点赞
评论
收藏
分享
02-25 16:49
中国传媒大学 数据分析师
题解 | 获取当前薪水第二多的员工的emp_no以及其对应的薪水salary
select a.emp_no,a.salary from (select emp_no,salary, dense_rank() over (order by salary desc) as rk from salaries) as a where a.rk=2 order by a.emp_no 通过select新筛选的表一定 要记得重新赋名
0
点赞
评论
收藏
分享
02-25 16:33
中国传媒大学 数据分析师
题解 | 查找employees表emp_no与last_name的员工信息
select * from employees where emp_no%2=1 and last_name!='Mary' order by hire_date desc 奇数的定义:指不能被2整除的整数除以2的余数为1,表示为:a%2=1 或者 mod(a,2)=1如果a的数值可能为负值,可以用abs将负数转为绝对值再进行计算,表示为:ABS(a)%2=1
0
点赞
评论
收藏
分享
02-25 16:14
中国传媒大学 数据分析师
题解 | 获取每个部门中薪水最高的员工相关信息
select c.dept_no,c.emp_no,c.salary from (select a.dept_no,a.emp_no,b.salary, dense_rank() over (partition by dept_no order by salary desc) as rk from (dept_emp as a left join salaries as b on a.emp_no=b.emp_no)) as c where c.rk=1 order by c.dept_no 先合并两个表,然后增加一列排名,再抽取排名为1的数据,最后排序题目并没有要求筛选是否在职,个人觉得再筛...
0
点赞
评论
收藏
分享
02-25 15:30
中国传媒大学 数据分析师
题解 | 获取所有员工当前的manager
select a.emp_no,b.emp_no as manager from (dept_emp as a left join dept_manager as b on a.dept_no=b.dept_no) where a.emp_no!=b.emp_no 不相等的关系用‘!=’表示
0
点赞
评论
收藏
分享
02-25 15:15
中国传媒大学 数据分析师
题解 | 查找薪水记录超过15条的员工号emp_no以及其对应的记录次数t
select emp_no,count(emp_no) as t from salaries group by emp_no having t>15 count函数算的是emp_no的数量,不可以用 * 简单代替
0
点赞
评论
收藏
分享
02-25 14:51
中国传媒大学 数据分析师
题解 | 查找当前薪水详情以及部门编号dept_no
select a.emp_no,b.salary,b.from_date,b.to_date,a.dept_no from(dept_manager as a left join salaries as b on a.emp_no=b.emp_no) order by emp_no 用了左链接给两个表重新赋名,要记得select里面的要加上新的赋名
0
点赞
评论
收藏
分享
02-25 14:41
中国传媒大学 数据分析师
题解 | 查找入职员工时间升序排名的情况下的倒数第三的员工所有信息
select emp_no,birth_date,first_name,last_name,gender,hire_date from ( select*,dense_rank() over (order by hire_date desc)as ranking from employees) as a where a.ranking=3 子查询出来的表格每次都忘记给名字卡住……
0
点赞
评论
收藏
分享
02-20 20:30
中国传媒大学 数据分析师
题解 | 21年8月份练题总数
select count(distinct device_id) as did_cnt,count(*)question_cnt from question_practice_detail where year(date)=2021 and month(date)=8 日期的定义方法是year(date)=2021 and month(date)=8数据去重 distinct
0
点赞
评论
收藏
分享
02-20 19:57
中国传媒大学 数据分析师
题解 | 统计复旦用户8月练题情况
select up.device_id,university, count(question_id) as question_cnt, count(if(qpd.result='right', 1, null)) as right_question_cnt from user_profile as up left join question_practice_detail as qpd on qpd.device_id = up.device_id and month(qpd.date) = 8 where up.university = '复旦大学' group by up.device_i...
0
点赞
评论
收藏
分享
02-20 15:40
中国传媒大学 数据分析师
题解 | 截取出年龄
select substring_index(substring_index(profile,',',3),',',-1) as age,count(*) as number from user_submit group by age substring_index进行两次运算,第二次是在第一次的提取基础上再运算的,所以应该是-1
0
点赞
评论
收藏
分享
02-18 14:11
中国传媒大学 数据分析师
题解 | 查看不同年龄段的用户明细
select device_id,gender, case when age<20 then '20岁以下' when age between 20 and 24 then '20-24岁' when age>=25 then '25岁及以上' when age is null then '其他' end as age_cut from user_profile 这样也可以,要留意between的拼写
0
点赞
评论
收藏
分享
02-18 13:55
中国传媒大学 数据分析师
题解 | 计算25岁以上和以下的用户数量
select case when age>=25 then '25岁及以上' when age<25 or age is null then '25岁以下' end as age_cut,count(*) as number from user_profile group by age_cut 由于数据中含有null的空值,所以要用*来进行count运算
0
点赞
评论
收藏
分享
1
2
创作者周榜
更多
关注他的用户也关注了:
牛客网
牛客网在线编程
牛客网题解
牛客企业服务