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 ...
随机推荐
- powerdesigner连接MySQL数据库时出现Non SQL Error : Could not load class com.mysql.jdbc.Driver
Non SQL Error : Could not load class com.mysql.jdbc.Driver 这是因为powerdesigner 无法找到驱动所产生的 解决办法是:配置系统的c ...
- 树莓派 - platform总线,设备和驱动
以树莓派为例子,分析一下其中LED的 platform device 和 platform driver. 查看LED设备,被挂载在/sys/devices/platform下. 注意其中的drive ...
- Python中的数据类型之字符串
字符串的定义,可是使用类似下面的方式 name = "hello python" Python 中字符串自带了一些常用的方法,比如: title() #用来将每个单词首字母大写up ...
- LeetCode(4)Median of Two Sorted Arrays
题目 There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the ...
- keil mdk uvision使用技巧
语法检测&代码提示 中文友好: tab 可以选中一大块代码,一起缩进 快速注释 先选中你要注释的代码区,然后右键,选择Advanced,Comment Selection 就可以了 查找替换 ...
- Qt项目——数字内容管理系统的参考资料和细节
打开文件路径,若带空格,要用引号括起路径 LPCWSTR与QString的转换:LPCWSTR strL = strQ.toStdWString().c_str(); 用指定程序打开文件(选择文件的打 ...
- Git和SVN共存的方法
刚工作的时候都是用的cvs和svn,对git不熟悉,随着工作的需要,打分支和版本管理的需要,熟悉起来了git,这一用不可收拾,比svn远远好用,尤其是版本分支管理上,切换分支的方便性,现在这家公司还是 ...
- 创建Javaweb项目及MyEclipse视图的配置
在myEclipse里--右键new--Web Project 视图的配置--Window--Show View-Other在里面输入要找的视图例如(servers)或者直接 Window--rese ...
- 59. Spring Boot Validator校验【从零开始学Spring Boot】
大纲: (1) 入门例子: (2) 国际化: (3) 在代码中添加错误信息: (1) 入门例子: Validator主要是校验用户提交的数据的合理性的,比如是否为空了,密码长度是否大于6位,是否是纯数 ...
- COJ 1163 乘法逆元的求解
乘法逆元就是求一个 a/b = c(mod m)在已知a%m , b%m 的条件下 求c的解 #include <cstdio> #include <cstring> usin ...