念_长征
念_长征
全部文章
分类
归档
标签
去牛客网
登录
/
注册
念_长征的博客
全部文章
(共166篇)
题解 | #出现三次以上相同积分的情况#
select `number` from grade group by `number` having count(*)>=3 order by `number`;
2024-02-16
0
152
题解
# 需要使用窗口函数来赋予排名 select first_name first from employees where first_name in ( select first_name from ( select first_name, row_number()o...
2024-02-16
0
180
题解 | 统计salary的累计和
select emp_no, salary, sum(salary)over(order by emp_no) running_total from salaries where to_date = '9999-01-01';
2024-02-16
0
148
题解 | #获取有奖金的员工相关信息。#
# 先连接employees和emp_bonus表 select e.emp_no, first_name, last_name, btype from employees e join emp_bonus eb on e.emp_no=eb.emp_no # 再将上表与salaries表连接 s...
2024-02-16
0
252
题解 | #每篇文章同一时刻最大在看人数#
# 每篇文章同一时刻最大在看人数,想象固定一个门,观察发生浏览人数变化的时刻点统计其进入和离开的人数 # (1)将各记录分成两个,一个记录进入时间,一个记录离开时间,然后联合两表 with t1 as (select artical_id, in_time tag_time, 1 tag from ...
2024-02-16
0
186
题解 | 查找未分配具体部门的员工的所有信息。
select * from employees e where not exists ( select * from dept_emp d where d.emp_no = e.emp_no ); 关于 not exists的使用,如果后面接的子查询结果集为空,则该条件满足;
2024-02-06
0
235
题解 | #分页查询employees表
select * from employees limit 5, 5;
2024-02-06
0
188
题解 | #平均工资#
# 先查询在职员工的最高工资和最低工资 select max(salary) max_s, min(salary) min_s from salaries where to_date = '9999-01-01' # 查询排除最高工资和最低工资的员工平均工资 select avg(salary) ...
2024-02-06
0
195
题解 | #按照dept_no进行汇总#
select dept_no, group_concat(emp_no separator ',') employees from dept_emp group by dept_no;
2024-02-01
0
182
题解 | #获取employees中的first_name
select first_name from ( select first_name, substr(first_name, char_length(first_name)-1) last_2 from employees ) k1 order by last_2; sub...
2024-02-01
0
169
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页