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的更多相关文章

  1. Leetcode 176. Second Highest Salary

    Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...

  2. LeetCode 176. Second Highest Salary (第二高的薪水)

    题目标签: 题目给了我们一个工资表,让我们返回第二高的工资. 利用Max,把第一高的工资找到,然后利用 NOT IN,去找到第二高的工资. Java Solution: Runtime:  153ms ...

  3. LeetCode 177. Nth Highest Salary

    https://leetcode.com/problems/nth-highest-salary/description/ Write a SQL query to get the nth highe ...

  4. 176. Second Highest Salary

    Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...

  5. LeetCode DB: Department Highest Salary

    The Employee table holds all employees. Every employee has an Id, a salary, and there is also a colu ...

  6. [LeetCode] 176. Second Highest Salary_Easy tag: SQL

    Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...

  7. LeetCode SQL: Second Highest Salary

    , NULL, salary) as `salary` from ( ,) tmp Write a SQL query to get the second highest salary from th ...

  8. 【SQL】176. Second Highest Salary

    Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...

  9. [LeetCode#184]Department Highest Salary

    The Employee table holds all employees. Every employee has an Id, a salary, and there is also a colu ...

随机推荐

  1. HDU 1258 Sum It Up

    Sum It Up Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total S ...

  2. 安装 Open Live Writer

    2016年12月19日20:22:02 一直希望能有一个独立的客户端来书写博客,作为一个新手,希望能够有一个强大的编辑器来实现这个功能.然后就赶着去下载windows live Writer.然后才发 ...

  3. [python]使用virtualenv处理python版本问题

    1. 更新virutalenv $ sudo easy_install --upgrade virtualenv   2. 新建virtualenv实例, 确保在your home directory ...

  4. ASP.NET WEBAPI 简单CURD综合测试(asp.net MVC,json.net,sql基础存储过程和视图,sqlhelper,json解析)

    草图   真正的后端是不管前端是什么平台,用什么语言的,JSON格式的数据应该可以应对.用ASP.NET WEBAPI尝试做一个后端,实现最基本的CURD,业务逻辑和数据库操作都放在后端,前端只需要正 ...

  5. Silverlight 限制 规则输入(正整数或小数)的另一种“技巧”写法

    今天上午纠结一个问题很久,silverlight TextBox限制用户规则输入,要求只能输入正整数或则小数,小数点只能有且只有一个 刚开始的时候就是想直接用keyDown事件里面来解决    voi ...

  6. 人工智能系统Google开源的TensorFlow官方文档中文版

    人工智能系统Google开源的TensorFlow官方文档中文版 2015年11月9日,Google发布人工智能系统TensorFlow并宣布开源,机器学习作为人工智能的一种类型,可以让软件根据大量的 ...

  7. javaWeb 使用 filter 处理全站乱码问题

    1. web.xml文件中的配置 <filter> <filter-name>CharacterEncodingFilter</filter-name> <f ...

  8. urllib编码

    python: 1.unquote 2.decode 3.encode

  9. HashCode

    如果一个类的对象要用做hashMap的key,那么一定要注意覆盖该类的equals和hashCode方法. equals()是基类Object的方法,用于判断对象是否有相同地址及是否为同一对象 pub ...

  10. PHP-----数据类型,运算符

    文件解析流程: 基本语法: 和Javascript很像.Ps:变量名可以使用关键字,但是最好不建议使用.关于PHP和HTML的混编,写起来可能比较方便,但是不便于阅读. 数据类型: 其中的资源类型是一 ...