leetcode Database4
2024-08-30 16:08:08
一、Department Top Three Salaries
The Employee
table holds all employees. Every employee has an Id, and there is also a column for the department Id.
+----+-------+--------+--------------+
| Id | Name | Salary | DepartmentId |
+----+-------+--------+--------------+
| 1 | Joe | 70000 | 1 |
| 2 | Henry | 80000 | 2 |
| 3 | Sam | 60000 | 2 |
| 4 | Max | 90000 | 1 |
| 5 | Janet | 69000 | 1 |
| 6 | Randy | 85000 | 1 |
+----+-------+--------+--------------+
The Department
table holds all departments of the company.
+----+----------+
| Id | Name |
+----+----------+
| 1 | IT |
| 2 | Sales |
+----+----------+
Write a SQL query to find employees who earn the top three salaries in each of the department. For the above tables, your SQL query should return the following rows.
+------------+----------+--------+
| Department | Employee | Salary |
+------------+----------+--------+
| IT | Max | 90000 |
| IT | Randy | 85000 |
| IT | Joe | 70000 |
| Sales | Henry | 80000 |
| Sales | Sam | 60000 |
+------------+----------+--------+ 分析:
最新文章
- WWDC2016 观后杂感
- 不可或缺 Windows Native (13) - C++: 标准输入, 标准输出, 字符串内存流
- iOS - 获取手机中所有图片
- iso中AutoLayout和Autoresizing Mask的区别
- OC8_代理基本概念
- 解决Windows2008Server上PLSQL登录时报ORA-12557
- Android 百度地图开发之一(Hello BaiDu Map)
- ActionBarSherlock
- jq总结
- uap--studio设置文本字体
- mybatis 打印SQL语句
- [C++基金会]位计算 游戏开发中的应用
- LoadRunner学习知多少--IP欺骗使用
- BizTalk Server 2010高可用方案
- L362 When to Bring up Salary During the Job Interview Process
- luogu P1077 摆花
- 第二十节,使用RNN网络拟合回声信号序列
- CentOS中环境变量和配置文件
- Andrew Ng机器学习课程笔记(三)之正则化
- Python yield 使用浅析(转)
热门文章
- Zookeeper入门(二)之基础
- 使用sysbench 进行msyql oltp压力测试
- linux iostat 性能指标说明(转)
- 警惕ASP.NET MVC中的ValidateInputAttribute
- mysql事务,select for update,及数据的一致性处理
- UCOSII笔记---信号量、邮箱、消息队列、信号量集、软件定时器
- LoRa---她的简介和她的专业术语
- ssh无法登录,提示Connection closing...Socket close.
- helloworld讲解cocos2d-x的编程思路与要点
- coco2d-x游戏逻辑结构