想拿SSS开局的掘金者
想拿SSS开局的掘金者
全部文章
分类
归档
标签
去牛客网
登录
/
注册
想拿SSS开局的掘金者的博客
全部文章
(共23篇)
题解 | #查找当前薪水详情以及部门编号dept_no#
select s.emp_no, s.salary, s.from_date, s.to_date, d.dept_no from salaries s join dept_manager d on s.emp_no = d.emp_no order by s.emp_no 难点: 表的连接。 ...
2024-08-22
0
99
将id=5及emp_no=10001的行替换id=5及
update titles_test set emp_no = replace(emp_no, 10001,10005) where id = '5' and emp_no = '10001' 本题 的难点 ,一是更新数据, update +表+ set , 另一个是 replace (...
2024-08-22
1
94
将所有to_date为9999-01-01更新为NULL
update titles_test set to_date = null ,from_date = '2001-01-01' where to_date = '9999-01-01' 本题 的难点在于,'数据的更换' update +表 + set 语句。 (1) set 语句中, ...
2024-08-22
0
97
题解 将emp表的员工last_n和first_n拼接起来
select concat(last_name,' ',first_name) name from employees 重点在 ‘字符串’的连接函数 concat(s1,s2,s3 ) concat( ) 中,是 ‘字段’, 直接写, 是‘字符串’,则需要用 引号,括起来 ‘abc’, ...
2024-08-21
0
91
题解 | 删除emp_no重复的记录,只保留最小的id的记录
delete from titles_test p where p.id in( select t.id from ( select *, row_number()over(partition by emp_no order by id) pson from titles_t...
2024-08-21
0
139
题解 | 获取当前薪水第二多的员工的emp_no以及其薪水
select emp_no, salary from ( select emp_no, salary, dense_rank()over(order by salary desc) posn from salaries ) as t where t.posn = 2 当前薪水第二多:...
2024-08-20
0
125
题解 | 查找emp表emp_no与last_name的信息
select * from employees where mod(emp_no, 2) = 1 and last_name != 'Mary' order by hire_date desc 此题的重点,在于“取奇”数, mod(a, b)=1/0 , (1)mod(a,b) 在sql...
2024-08-20
0
102
题解 | #获取所有非manager的员工emp_no#
select e.emp_no from employees e where e.emp_no not in( select d.emp_no from dept_manager d join employees e on d.emp_no = e.emp_no ) 本题是 w...
2024-08-19
1
92
题解 | #找出所有员工当前薪水salary情况#
select salary from salaries group by salary order by salary desc 1、此题的关键有两个点, 一个是 去重, 一个是排序2、去掉重复的值(相同的只显示一次): group by 具有 分组 和 去重的双重功能,所以只需要对 薪水sal...
2024-08-19
1
108
题解 | 查找薪水记录超过15条的员工号emp_及其记录次数
select emp_no, count(emp_no) t from salaries group by emp_no having count(emp_no) > 15 1、查找薪水记录超过15条的员工号。 薪水记录这个其实指的就是“记录行数”,所以要用到聚合运算 count() 2、考...
2024-08-19
1
122
首页
上一页
1
2
3
下一页
末页