LeetCode 176. Second Highest Salary (第二高的薪水)
题目标签:
题目给了我们一个工资表,让我们返回第二高的工资。
利用Max,把第一高的工资找到,然后利用 NOT IN,去找到第二高的工资。
Java Solution:
Runtime: 153ms, faster than 44 %
完成日期:05/22/2019
关键点:MAX, NOT IN
# Write your MySQL query statement below
SELECT Max(Salary) As SecondHighestSalary
FROM Employee
WHERE Salary
NOT IN (SELECT Max(Salary) FROM Employee);
参考资料:LeetCode Solution
LeetCode 题目列表 - LeetCode Questions List
题目来源:https://leetcode.com/
LeetCode 176. Second Highest Salary (第二高的薪水)的更多相关文章
- [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
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 ...
- [SQL]LeetCode176. 第二高的薪水 | Second Highest Salary
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...
- LeetCode 176. 第二高的薪水(MySQL版)
0.前言 最近刷LeetCode 刷数据库题目 由于数据库课上的是SQL,而MySQL有许多自己的函数的,怕把刚学会的函数忘记 特在此记录! 1.题目 编写一个 SQL 查询,获取 Employee ...
- SQL Server实现 LeetCode 176 第二高的薪水
176. 第二高的薪水 SQL架构 编写一个 SQL 查询,获取 Employee 表中第二高的薪水(Salary) . +----+--------+ | Id | Salary | +----+- ...
- LeetCode:176.第二高的薪水
题目链接:https://leetcode-cn.com/problems/second-highest-salary/ 题目 编写一个 SQL 查询,获取 Employee 表中第二高的薪水(Sal ...
- 176. Second Highest Salary
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...
- MYSQL查询第二高的薪水
编写一个 SQL 查询,获取 Employee 表中第二高的薪水(Salary) . +----+--------+| Id | Salary |+----+--------+| 1 | 100 || ...
随机推荐
- Linux环境下安装PHP的memced扩展
先下载libmemcached: wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.t ...
- Python 生成json文件
1.数据准备 数据下载 2.python代码 import datetime import os import mssqlhelper ms = mssqlhelper.MSSQL(host=&quo ...
- go解析markdown转成html
一.代码 package main import ( "fmt" "github.com/microcosm-cc/bluemonday" "gith ...
- 解决spring boot中普通类中使用service为null 的方法
我使用的是springboot+mybatisplus +mysql1.创建一个SpringUtil工具类 import org.springframework.beans.BeansExceptio ...
- TFS 中如何将项目加入已有的源代码管理器中?
Visual Studio 的某解决方案已经加入 Team Foundation Server,现在再将已经存在的项目加入到解决方案中,可是签入时,并没有把新加入的项目签入,怎么办呢? 在团队资源管理 ...
- 用EditText控件的属性inputType
android:inputType参数类型说明 android:inputType="none"--输入普通字符 android:inputType="text" ...
- mybatis执行test07测试类却显示test05测试类调用的sql语句出错
1.测试类 @Test public void test07() { IStudentDao studentDao = new IStudentDaoImpl(); Student student = ...
- 7年Java后端被淘汰,一路北漂辛酸史。。。
作者:春天花会开foryou oschina.net/question/3465562_2281392 今天分享一位同行的经历: 本人Java开发6年半不到7年的样子. 英语专业,临毕业跟着隔壁专业去 ...
- Intellij IDEA gradle项目目录介绍
Gradle简介 Java的构建,经历了从Ant-->Maven->Gradle的过程,每一次的进步,都是为了解决之前的工具带来的问题: Ant:Ant的功能虽然强大,但过于灵活,规范性不 ...
- docker Dockerfile学习---构建redis环境
1.创建项目目录并下载包及文件 mkdir centos_redis cd centos_redis wget http://download.redis.io/releases/redis-5.0. ...