当前位置:网站首页>MySQL Niuke brush questions
MySQL Niuke brush questions
2022-06-23 07:14:00 【Begin to change】
Catalog
One 、 Get all non manager Employee salary , give dept_no、emp_no as well as salary
One 、 Get all non manager Employee salary , give dept_no、emp_no as well as salary
1、 subject
2、 Ideas
First, combine the employee information and salary into a table , The same is true of managers ;
Then connect the two tables , The connection condition is that the department number is the same , Finally, find the desired information from this large table , The precondition is that the employee's salary is greater than the manager's salary ;
The manager is also part of the staff , So the data in the first table contains the manager's data , But this doesn't affect the later results , Because what is needed is that the salary is greater than, it is excluded
If the condition is greater than or equal to , It is necessary to judge whether the employee number is in the manager table before establishing the employee salary table ;
3、 Source code
select b1.emp_no, manager_no, emp_salary, manager_salary
from(
select dept_no, de.emp_no, salary as emp_salary
from dept_emp as de
join salaries as s
on de.emp_no = s.emp_no
)as b1
join (
select dept_no, dm.emp_no as manager_no, salary as manager_salary
from dept_manager as dm
join salaries as s
on dm.emp_no = s.emp_no
)as b2
on b1.dept_no = b2.dept_no
where b1.emp_salary > b2.manager_salary
边栏推荐
- 宝塔忘记密码
- 313. 超级丑数
- 深度学习系列47:styleGAN总结
- 20220620 uniformly completely observable (UCO)
- 【2022毕业季】从毕业到转入职场
- Tp6+redis+think-queue+supervisor implements the process resident message queue /job task
- TP6+Redis+think-queue+Supervisor实现进程常驻消息队列/job任务
- WPF command directive and inotifypropertychanged
- Analysis of personalized learning progress in maker Education
- The List
猜你喜欢

深度学习系列47:超分模型Real-ESRGAN

20220621 Three Conjugates of Dual Quaternions

Akamai-1.75版本-_abck参数生成-js逆向分析

正则表达式图文超详细总结不用死记硬背(上篇)

Advanced drawing skills of Excel lecture 100 (VIII) -excel drawing WiFi diagram

20220621 Dual Quaternion

Traversal of binary tree and related knowledge

Initialization layer implementation

别找了诸位 【十二款超级好用的谷歌插件都在这】(确定不来看看?)

深度学习系列47:styleGAN总结
随机推荐
Initialization layer implementation
Project_ Filter to solve Chinese garbled code
Pspnet complete code implementation
什么是分布式?
312. poke the balloon
307. area and retrieval - array modifiable
897. 递增顺序搜索树
启发式的搜索策略
In depth learning series 46: face image super score gfp-gan
Xshell7 Download
如何在 PHP 中进行日期格式验证检查(正则)
[system] right click the desktop icon. After turning around, the Explorer will crash and the desktop will be refreshed
About Supervision
20220620 uniformly completely observable (UCO)
406 double pointer (27. remove elements, 977. square of ordered array, 15. sum of three numbers, 18. sum of four numbers)
Technical article writing guide
深度学习系列47:超分模型Real-ESRGAN
数据库原理实验测试题,关于图书分类表
Side effects of threads in embedded real-time systems
用户态和内核态