176. Second Highest Salary


1. 问题描写叙述:

写一个sql语句从 Employee 表里获取第二高位的工资。

2. 解决思路:

这道题非常easy,就当热身了。首先用max找到最高工资。

然后去找小于最高工资里的最高工资就是第二高的工资。

3. sql语句:

select Max(Salary)
from Employee
where Salary < (select Max(Salary) from Employee)

4. 执行时间:


希望多多交流指正!

LeetCode_Mysql_Second Highest Salary的更多相关文章

  1. [LeetCode] Department Highest Salary 系里最高薪水

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

  2. [LeetCode] Nth Highest Salary 第N高薪水

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

  3. [LeetCode] Second Highest Salary 第二高薪水

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

  4. 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 ...

  5. 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. +----+ ...

  6. TSQL Beginners Challenge 1 - Find the second highest salary for each department

    很久以前准备写的系列文章,后来因为懒一直耽搁着,今天突然决定继续下去,于是有了这篇文章,很基础,但很常用.题目描述依然拷贝.简单来说就是找出个个部门薪水排名第二的人,排名相同的要一起列出来. Intr ...

  7. Leetcode 176. Second Highest Salary

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

  8. find the Nth highest salary(寻找第N高薪水)

    Suppose that you are given the following simple database table called Employee that has 2 columns na ...

  9. [SQL]LeetCode176. 第二高的薪水 | Second Highest Salary

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

随机推荐

  1. zabbix4.2学习笔记--TCP状态监控

    Tcp的连接状态对于我们web服务器来说是至关重要的,尤其是并发量ESTAB:或者是syn_recv值,假如这个值比较大的话我们可以认为是不是受到了攻击(例如SYN攻击),或是是time_wait值比 ...

  2. C# html table转excel

    1. protected void ebtDC_Click(object sender, EventArgs e) { string elxStr = "<table><t ...

  3. mybatis传多个参数(不使用@param注解情况下),3.4.2版本之后出现#{0}-#{n}参数绑定异常

    解决方案: 在mybatis配置文件中声明setting属性的useActualParamName 参数值为false ** 这种方法解决mybatis3.4.2之后的版本产生该问题的解决方法**

  4. Mysql对象

    2.简介 2.1 存储过程 2.1.1什么是存储过程 存储过程就是一种类似函数的脚本,可以把多个sql语句组合起来,然后使用 call 存储过程名 来调用,从而执行这些SQL语句. 特点:一次编译,下 ...

  5. [Python3网络爬虫开发实战] 7.2-Splash的使用

    Splash是一个JavaScript渲染服务,是一个带有HTTP API的轻量级浏览器,同时它对接了Python中的Twisted和QT库.利用它,我们同样可以实现动态渲染页面的抓取. 1. 功能介 ...

  6. C#基础学习(二)

    ---恢复内容开始--- 面向对象 (类是不占内存,实例占内存) C#与python不用可以直接从另一个文件直接实例化一个类,不需要导包:                                ...

  7. 1. 垃圾收集简介 - GC参考手册

    说明: 在本文中, Garbage Collection 翻译为 “垃圾收集”, garbage collector 翻译为 “垃圾收集器”; 一般认为, 垃圾回收 和 垃圾收集 是同义词. Mino ...

  8. 慕课笔记利用css进行布局【混合布局】

    <html> <head> <title>混合布局学习</title> <style type="text/css"> ...

  9. NYOJ-476谁是英雄,分解质因子求约数个数!

    谁是英雄 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描述 十个数学家(编号0-9)乘气球飞行在太平洋上空.当横越赤道时,他们决定庆祝一下这一壮举.于是他们开了一瓶香槟.不 ...

  10. spark streaming基于Kafka的开发

    spark streaming使用Kafka数据源进行数据处理,本文侧重讲述实践使用. 一.基于receiver的方式 在使用receiver的时候,如果receiver和partition分配不当, ...