[LeetCode#184]Department Highest Salary
The Employee table holds all employees. Every employee has an Id, a salary, and there is also a column for the department Id. +----+-------+--------+--------------+
| Id | Name | Salary | DepartmentId |
+----+-------+--------+--------------+
| 1 | Joe | 70000 | 1 |
| 2 | Jim | 90000 | 1 |
| 3 | Henry | 80000 | 2 |
| 4 | Sam | 60000 | 2 |
| 5 | Max | 90000 | 1 |
+----+-------+--------+--------------+
The Department table holds all departments of the company. +----+----------+
| Id | Name |
+----+----------+
| 1 | IT |
| 2 | Sales |
+----+----------+
Write a SQL query to find employees who have the highest salary in each of the departments. For the above tables, your SQL query should return the following rows (order of rows does not matter). +------------+----------+--------+
| Department | Employee | Salary |
+------------+----------+--------+
| IT | Max | 90000 |
| IT | Jim | 90000 |
| Sales | Henry | 80000 |
+------------+----------+--------+
Explanation: Max and Jim both have the highest salary in the IT department and Henry has the highest salary in the Sales department.
本题是让我们找出不同部门中各个部门的最高工资中的人和具体的薪水。题中有两张表,分别是Employee表和Department表,其中Employee表中有的是Id、Name、Salary、和DepartmentId,Department表中含有的字段是Id和Name。需要求的表中的字段是Department、Employee和Salary.
[LeetCode#184]Department Highest Salary的更多相关文章
- LeetCode DB: Department Highest Salary
The Employee table holds all employees. Every employee has an Id, a salary, and there is also a colu ...
- 【SQL】184. Department Highest Salary
The Employee table holds all employees. Every employee has an Id, a salary, and there is also a colu ...
- 184. Department Highest Salary
问题描述 解决方案 select b.Name Department,a.Name Employee,a.Salary from ( select e1.Salary,e1.Name,e1.Depar ...
- [LeetCode] Department Highest Salary -- 数据库知识(mysql)
184. Department Highest Salary The Employee table holds all employees. Every employee has an Id, a s ...
- leetcode Database3(Nth Highest Salary<—>Consecutive Numbers<—>Department Highest Salary)
一.Nth Highest Salary Write a SQL query to get the nth highest salary from the Employee table. +----+ ...
- [LeetCode] Department Highest Salary 系里最高薪水
The Employee table holds all employees. Every employee has an Id, a salary, and there is also a colu ...
- LeetCode——Department Highest Salary(花式使用IN以及GROUP BY)
The Employee table holds all employees. Every employee has an Id, a salary, and there is also a colu ...
- [SQL]LeetCode184. 部门工资最高的员工 | Department Highest Salary
The Employee table holds all employees. Every employee has an Id, a salary, and there is also a colu ...
- LeetCode 176 Second Highest Salary mysql,select 嵌套 难度:1
https://leetcode.com/problems/second-highest-salary/ Write a SQL query to get the second highest sal ...
随机推荐
- linux-认识vi vim
vi 编译器 Linux vi 命令非常强大,熟练地使用它可以高效的编辑代码,配置系统文件等 命令:vi [文件] vim [文件] vi 分为三种模式:命令模式.文字模式.末尾模式 -------- ...
- com.mysql.cj.exceptions.DataReadException: Zero date value prohibited
com.mysql.cj.exceptions.DataReadException: Zero date value prohibited at com.mysql.cj.result.SqlTime ...
- R学习
R内容: R-1 基础 R-2 基础绘图 R-3 t分布--t置信区间--t检验 R-4 方差分析 R-5 相关分析-卡方分析 R-6 线性回归模型分析流程 R实战第7章 线性回归 逻辑回归 主成分分 ...
- git版本对比
1.git diff版本比对 (未添加到暂存区间之前的区别对比) 未进行修改,则显示为空 进行文件修改,再执行git diff 当执行git add . 之后,再次git diff则为空 缓存和提交 ...
- curl 带 body
curl -H "Content-Type:plain/text" -X POST -d '<?xml version="1.0" encoding=&q ...
- 集合系列 Set(七):LinkedHashSet
LinkedHashSet 继承了 HashSet,在此基础上维护了元素的插入顺序. public class LinkedHashSet<E> extends HashSet<E& ...
- 巧妙利用label标签实现input file上传文件自定义样式
提到上传文件,一般会想到用input file属性来实现,简单便捷,一行代码即可 但input file原生提供的默认样式大多情况下都不符合需求,且在不同浏览器上呈现的样式也不尽相同 我们往 ...
- CSAPP lab1——位运算
本次为一次计算机系统实验,就是使用一些基本的运算符来实现函数功能. ps做这些题让我想起大一上学期刚学二进制时被鹏哥支配的痛苦. 知识准备: 1.负数等于正数取反加一. 2.左移一位相当于将这个数扩大 ...
- ES6-Symbol的用法 ,symbol在对象中的应用,改变值
ES6-Symbol的用法,,symbol在对象中的应用,改变值 let a = new String; let b = new Number; let c = new Boolean; let d ...
- Cesium专栏-样条插值(平滑路径、飞行动画,源码下载)
Cesium Cesium 是一款面向三维地球和地图的,世界级的JavaScript开源产品.它提供了基于JavaScript语言的开发包,方便用户快速搭建一款零插件的虚拟地球Web应用,并在性能,精 ...