yyyy11一
yyyy11一
全部文章
分类
归档
标签
去牛客网
登录
/
注册
yyyy11一的博客
全部文章
(共87篇)
题解 | 获取有奖金的员工相关信息。
SELECT e.emp_no, e.first_name, e.last_name, em.btype, -- 统一引用 em 表的 btype(原表关联是 emp_bonus AS em) s.salary, -- 明确引用薪资表 s 的 salary 字段 ROUND( ...
2025-11-18
0
32
题解 | 使用含有关键字exists查找未分配具体部门的员工的所有信息。
select * from employees where not exists (select D.emp_no from dept_emp D where employees.emp_no=D.emp_no) where not
2025-11-17
0
28
题解 | 分页查询employees表,每5行一页,返回第2页的数据
select * from employees limit 5 offset 5 limit 跳过五条 取五条
2025-11-17
0
26
题解 | 按照dept_no进行汇总
select dept_no,group_concat(emp_no) employees FROM dept_emp GROUP BY dept_no
2025-11-16
0
48
题解 | 获取employees中的first_name
SELECT first_name FROM employees ORDER BY substr(first_name,-2,2) substr(first_name,-2,2)获取每一行 first_name 的「倒数两个字符」
2025-11-16
0
36
题解 | 将employees中last_name和first_name通过符号连接起来。
select concat(last_name,"'",first_name) from employees concat 连接字符串
2025-11-16
0
28
题解 | 将所有获取奖金的员工当前的薪水增加10%
update salaries s join emp_bonus e on e.emp_no=s.emp_no--emp_bonus里面的emp_no都是当前获奖的所有员工 SET salary =salary*1.1 --薪水涨幅10% where to_date='9999-01-01' 筛...
2025-11-16
0
23
题解 | 将titles_test表名修改为titles_2017
ALTER TABLE titles_test rename TO titles_2017; alter table 旧表名rename to 新表名
2025-11-16
0
30
题解 | 将所有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 指定要更新的字段及对应新值where 过滤
2025-11-16
0
29
题解 | 删除emp_no重复的记录,只保留最小的id对应的记录。
delete from titles_test where id not in --删除来自表不等于id最小的列 (select * from (select min(id)--子查询id最小的列 from titles_test group by emp_no) a) 删除列通过where定位精准...
2025-11-16
0
27
首页
上一页
1
2
3
4
5
6
7
8
9
下一页
末页