LeetCode 176 Second Highest Salary mysql,select 嵌套 难度:1
https://leetcode.com/problems/second-highest-salary/
Write a SQL query to get the second highest salary from the Employee table.
+----+--------+
| Id | Salary |
+----+--------+
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |
+----+--------+
For example, given the above Employee table, the second highest salary is 200. If there is no second highest salary, then the query should return null.
# Write your MySQL query statement below
select max(Salary) from Employee where Salary < (select max(Salary) from Employee);
LeetCode 176 Second Highest Salary mysql,select 嵌套 难度:1的更多相关文章
- Leetcode 176. Second Highest Salary
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...
- LeetCode 176. Second Highest Salary (第二高的薪水)
题目标签: 题目给了我们一个工资表,让我们返回第二高的工资. 利用Max,把第一高的工资找到,然后利用 NOT IN,去找到第二高的工资. Java Solution: Runtime: 153ms ...
- LeetCode 177. Nth Highest Salary
https://leetcode.com/problems/nth-highest-salary/description/ Write a SQL query to get the nth highe ...
- 176. Second Highest Salary
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...
- LeetCode DB: 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_Easy tag: SQL
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...
- LeetCode SQL: Second Highest Salary
, NULL, salary) as `salary` from ( ,) tmp Write a SQL query to get the second highest salary from th ...
- 【SQL】176. Second Highest Salary
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...
- [LeetCode#184]Department Highest Salary
The Employee table holds all employees. Every employee has an Id, a salary, and there is also a colu ...
随机推荐
- JSP-11-Servlet
1 初识Servlet Ø Servlet做了什么 本身不做业务 只接收请求并决定调用哪个JavaBean去处理请求 确定用哪个页面来显示处理返回的数据 Ø Servlet 是什么 Servlet ...
- POJ - 2183 Bovine Math Geniuses
“模拟“题,运用哈希,不断地按照一定运算规律对一个结果进行计算,如果重复出现就停止并且输出该数.注意到仔细看题,这种题一定要细心! POJ - 2183 Bovine Math Geniuses Ti ...
- 方法过滤器,分布式缓存 Memcached实现Session解决方案
控制器-〉方法过滤器-〉controller-> 方法 所以通过建立controller基类的方法进行方法过滤,所有控制器先执行基类的OnActionExecuting 方法. using Sp ...
- this的面面观
http://www.cnblogs.com/Wayou/p/all-this.html <JavaScript语言精粹> 全局this 浏览器宿主的全局环境中, function f(x ...
- nodejs学习笔记
这里有一段废话,我写了又删,删了又写,反复了十来次,最后还是把它删除了.不用想了,那是一段牢骚话兼有煽情意思. 好了,还是把我学习nodejs的笔记记录下来吧,一来复习巩固,加深印象,二来自己实践中出 ...
- 将HTML5 Canvas的内容保存为图片借助toDataURL实现
将HTML5 Canvas的内容保存为图片主要思想是借助Canvas自己的API - toDataURL()来实现,具体实现如下,感兴趣的朋友可以参考下哈,希望对你有所帮助 <html> ...
- linux查看磁盘系统df,du
可以用df命令轻松地查看所有已挂载磁盘的使用情况 df df -h 把输出的文件单位换成文件可读的单位 du 命令显示特定目录的使用情况 du -c 显示总用量 du -h 人类可读性 du -s 每 ...
- 关于cookie的文章(cookie与session机制)
会话(Session)跟踪是Web程序中常用的技术,用来跟踪用户的整个会话.常用的会话跟踪技术是Cookie与Session.Cookie通过在客户端记录信息确定用户身份,Session通过在服务器端 ...
- JAVA基础知识之JDBC——编程步骤及执行SQL
JDBC编程步骤 下面以mysql数据库为例, 1.加载驱动 首先需要下载数据库的驱动jar文件,并且在eclipse包中加入到class path中去, 例如mysql的驱动文件 mysql-con ...
- noi 666 放苹果
题目链接:http://noi.openjudge.cn/ch0206/666/ 和ural 1114题意类似,但是有顺序,5,1,1和1,5,1是同一种序列.不能直接枚举 d(i,j) 前 i 个盘 ...