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. 一个IP能建立的最大连接数是多少?

    在探讨这个问题前,我们先假设一种经典的连接模型: Client -> Load Balancer-> RealServer Pool 并且我们假设这里使用NAT模式的负载均衡,在这种模式下 ...

  2. Shell脚本关于屏幕输出的字符进行颜色控制的问题

    文本终端的颜色可以使用“ANSI非常规字符序列”来生成.举例: echo -e "\033[44;37;5m ME \033[0m COOL" 以上命令设置背景成为蓝色,前景白色, ...

  3. 免费的网络扫描器-Advanced IP Scanner

    软件会自动检测电脑所在的网段,自动决定扫描范围.(例如电脑IP是192.168.1.101,扫描范围就是192.168.1.*) 官方网站:http://www.advanced-ip-scanner ...

  4. Maven打包pom里面配置exclude 排除掉环境相关的配置文件

    Maven打包pom里面配置exclude 排除掉环境相关的配置文件 有几种方式:1. 打包时,指定环境参数把环境的配置文件复制过去2. 不打包所有的环境相关的配置文件,直接由运维的人维护 可以在上传 ...

  5. zigbee学习之路(六):Time3(查询方式)

    一.前言 通过上次的学习,相信大家对cc2530单片机的定时器的使用有了一定的了解,今天我们来介绍定时器3的使用,为什么介绍定时器3呢,因为它和定时器4功能是差不多的,所以学会定时器3,就基本掌握了c ...

  6. linux deepin-scrot 截图工具

    1.下载 .deb 安装包: 点击这里   (如果提示缺少依赖,去终端安装相应的依赖) 2. 设置快捷键Alt+Ctrl+A 1. 系统设置 -> 键盘设置 -> 自定义快捷键 -> ...

  7. iotop命令

    简介: iotop – simple top-like I/O monitor iotop是一个用来监视磁盘I/O使用状况的 top 类工具,可监测到哪一个程序使用的磁盘IO的信息(requires ...

  8. Reflection

    Reflection 反射能在运行时获取一个类的全部信息,并且可以调用类方法,修改类属性,创建类实例. 而在编译期间不用关心对象是谁 反射可用在动态代理,注解解释,和反射工厂等地方. -------- ...

  9. [问题2015S14] 复旦高等代数 II(14级)每周一题(第十五教学周)

    [问题2015S14]  设 \(J=\begin{pmatrix} 0 & I_n \\ -I_n & 0 \\ \end{pmatrix}\), \(A\) 为 \(2n\) 阶实 ...

  10. 对css中clear元素的理解

    clear:left;表示左侧不能有浮动元素. clear:right;表示右侧不能有浮动元素. clear:both;表示左右两侧都不能有浮动元素. 但在使用时,还得考虑css优先级问题.相同类型选 ...