LeetCode_Mysql_Second Highest Salary
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的更多相关文章
- [LeetCode] Department Highest Salary 系里最高薪水
The Employee table holds all employees. Every employee has an Id, a salary, and there is also a colu ...
- [LeetCode] Nth Highest Salary 第N高薪水
Write a SQL query to get the nth highest salary from the Employee table. +----+--------+ | Id | Sala ...
- [LeetCode] Second Highest Salary 第二高薪水
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...
- 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 ...
- 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. +----+ ...
- TSQL Beginners Challenge 1 - Find the second highest salary for each department
很久以前准备写的系列文章,后来因为懒一直耽搁着,今天突然决定继续下去,于是有了这篇文章,很基础,但很常用.题目描述依然拷贝.简单来说就是找出个个部门薪水排名第二的人,排名相同的要一起列出来. Intr ...
- Leetcode 176. Second Highest Salary
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...
- find the Nth highest salary(寻找第N高薪水)
Suppose that you are given the following simple database table called Employee that has 2 columns na ...
- [SQL]LeetCode176. 第二高的薪水 | Second Highest Salary
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...
随机推荐
- CAD参数绘制圆(网页版)
CAD绘制图像的过程中,画圆的情况是非常常见的,用户可以设置圆的圆心位置及半径属性. 主要用到函数说明: _DMxDrawX::DrawCircle 绘制一个圆.详细说明如下: 参数 说明 DOUBL ...
- java_线程的同步机制
1.同步代码块: 使用synchronized包住可能会出现安全问题的代码 import static java.lang.Thread.sleep; class Test01{ public sta ...
- 01Oracle Database
Oracle Database Oracle Database又名Oracle RDBMS简称Oracle是甲骨文公司的一款关系数据库管理系统. Oracle Website.
- 子例程 subroutine
#! /usr/bin/perluse strict;use warnings;print "\n---------summation_STDIN_parameter----------\n ...
- hdfs深入:06、hdfs的写入过程
7.HDFS的文件写入过程 详细步骤解析: 1. client发起文件上传请求,通过RPC与NameNode建立通讯,NameNode检查目标文件是否已存在,父目录是否存在,返回是否可以上传: 2. ...
- JS和C#方法相互调用
JS和C#方法相互调用 1.JS调用C#后台方法 方法一: 1.首先建立一个按钮,在后台将调用或处理的内容写入button_click中;2.在前台写一个js函数,内容为document.getEle ...
- Tab键可访问的下拉菜单demo
<ul id="navigationRegion"> <li token="1" class="index_on"> ...
- 20181228 模拟赛 T3 字符串游戏 strGame 博弈论 字符串
3 字符串游戏(strGame.c/cpp/pas) 3.1 题目描述 pure 和 dirty 决定玩 T 局游戏.对于每一局游戏,有n个字符串,并且每一局游戏由K轮组成.具体规则如下:在每一轮 ...
- mysql主库与从库配置(并行复制配置)
主库: [mysqld] server-id = 2233port = 13306basedir = /usr/local/mysqldatadir = /usr/local/mysql/data s ...
- [Python3网络爬虫开发实战] 1.8.1-pyspider的安装
pyspider是国人binux编写的强大的网络爬虫框架,它带有强大的WebUI.脚本编辑器.任务监控器.项目管理器以及结果处理器,同时支持多种数据库后端.多种消息队列,另外还支持JavaScript ...