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. Getting start with dbus in systemd (02) - How to create a private dbus-daemon

    Getting start with dbus in systemd (02) 创建一个私有的dbus-daemon (session) 环境 这里我们会有两个app: app1(client),ap ...

  3. [HNOI/AHOI2018]转盘(线段树优化单调)

    gugu  bz lei了lei了,事独流体毒瘤题 一句话题意:任选一个点开始,每个时刻向前走一步或者站着不动 问实现每一个点都在$T_i$之后被访问到的最短时间 Step 1 该题可证: 最优方案必 ...

  4. [Python3网络爬虫开发实战] 1.8.1-pyspider的安装

    pyspider是国人binux编写的强大的网络爬虫框架,它带有强大的WebUI.脚本编辑器.任务监控器.项目管理器以及结果处理器,同时支持多种数据库后端.多种消息队列,另外还支持JavaScript ...

  5. mysql 创建简单的事件event

    创建事件语句: CREATE EVENT `事件名` ON SCHEDULE EVERY 1 DAY --每隔一天 STARTS '2015-10-16 00:00:00' --从这个时间开始 ON ...

  6. Python之trutle库-五角星

    Python之trutle库-五角星 #!/usr/bin/env python # coding: utf-8 # Python turtle库官方文档:https://docs.python.or ...

  7. Python中接收用户的输入

    一.如何去接收用户的输入?使用函数 input() 函数 input() 让程序暂停运行,等待用户输入一些文本,获取用户的输入后,Python将其存储到一个变量中,以方便后期使用. name = in ...

  8. 集训第四周(高效算法设计)H题 (贪心)

    Description   Most financial institutions had become insolvent during financial crisis and went bank ...

  9. ECNU 3260 袋鼠妈妈找孩子(dfs)

    链接:http://acm.ecnu.edu.cn/problem/3260/ 题意: 给出一个x,y,k.求从左上角到(x,y)最短路径不少于k而且最快到达(x,y)的迷宫.(迷宫有多个 输出其中一 ...

  10. 如何用nfs命令烧写内核和文件系统(网络下载文件到nandflash)(未完)

    使用tftp下载烧写 a.设uboot里的ip地址 set ipaddr 192.168.1.17(uboot的ip设置成同网段) set serverip 192.168.1.5(电脑本机作为服务i ...