牛客424968675号
牛客424968675号
全部文章
分类
题解(31)
归档
标签
去牛客网
登录
/
注册
牛客424968675号的博客
全部文章
(共25篇)
题解 | #牛客每个人最近的登录日期(四)#
select login.date,ifnull(n1.new_num,0)from login left join(select a.t_date,count(user_id) as new_numfrom(select min(date) as t_date,user_id from login...
2021-08-03
0
362
题解 | #牛客每个人最近的登录日期(三)#
SELECTround(count(distinct user_id)*1.0/(select count(distinct user_id)from login),3)from loginwhere (user_id,date)in(select user_id,date_add(min(date...
2021-08-03
0
425
题解 | #异常的邮件概率#
select a.date,round(sum(case a.type when'completed' then 0 else 1 end )*1.0/count(a.type),3)as pfrom (select e.send_id,e.receive_id,e.type,e.date,u1.i...
2021-08-02
0
378
题解 | #出现三次以上相同积分的情况#
select numberfrom gradegroup by numberhaving count(*)>=3 having 和 where 的区别https://www.huaweicloud.com/articles/00d8b9053add55b50c807934f79ee0d2.ht...
2021-08-02
0
411
题解 | #对于employees表中,给出奇数行的first_name#
SELECT e.first_nameFROM employees e JOIN( SELECT first_name , ROW_NUMBER() OVER(ORDER BY first_name ASC) AS r_num FROM employe...
2021-08-02
0
353
题解 | #统计salary的累计和running_total#
select emp_no, salary,sum(salary) over(order by emp_no) as running_totalfrom salarieswhere to_date='9999-01-01' https://zhuanlan.zhihu.com/p/120269203...
2021-08-02
0
355
题解 | #获取有奖金的员工相关信息。#
select employees.emp_no,employees.first_name,employees.last_name,b.btype,s.salary,(case b.btypewhen 1 then salary0.1when 2 then salary0.2else salary*0...
2021-07-29
0
352
题解 | #使用含有关键字exists查找未分配具体部门的员工的所有信息。#
select * from employeeswhere not EXISTS (select emp_no from dept_emp where employees.emp_no=dept_emp.emp_no) exists的详细解释在:https://zhuanlan.zhihu.com/p...
2021-07-29
0
372
题解 | #分页查询employees表,每5行一页,返回第2页的数据#
select *from employeesLIMIT 5,5这道题主要是limit 具体的教程在:https://www.w3cschool.cn/mysql/5nab1ptx.html注意用order by 和 limit 可以输出前几名这种
2021-07-29
0
375
题解 | #查找排除当前最大、最小salary之后的员工的平均工资avg_salary#
select avg(salary) as avg_salaryfrom salaries awhere to_date='9999-01-01'and a.salary not in (select max(salary) from salaries where to_date='9999-01-...
2021-07-29
0
460
首页
上一页
1
2
3
下一页
末页