当前位置:网站首页>2022.07.15_每日一题
2022.07.15_每日一题
2022-07-31 06:07:00 【诺.い】
176. 第二高的薪水
题目描述
SQL架构
Employee 表:
±------------±-----+
| Column Name | Type |
±------------±-----+
| id | int |
| salary | int |
±------------±-----+
id 是这个表的主键。
表的每一行包含员工的工资信息。
编写一个 SQL 查询,获取并返回 Employee 表中第二高的薪水 。如果不存在第二高的薪水,查询应该返回 null 。
查询结果如下例所示。
示例 1:
输入:
Employee 表:
+----+--------+
| id | salary |
+----+--------+
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |
+----+--------+
输出:
+---------------------+
| SecondHighestSalary |
+---------------------+
| 200 |
+---------------------+
示例 2:
输入:
Employee 表:
+----+--------+
| id | salary |
+----+--------+
| 1 | 100 |
+----+--------+
输出:
+---------------------+
| SecondHighestSalary |
+---------------------+
| null |
+---------------------+
coding
# Write your MySQL query statement below
select (
select distinct salary
from Employee
order by salary desc
limit 1,1
) as SecondHighestSalary
边栏推荐
猜你喜欢

Project exercise - memorandum (add, delete, modify, check)

自动翻译软件-批量批量自动翻译软件推荐

浅层了解欧拉函数

完美指南|如何使用 ODBC 进行无代理 Oracle 数据库监控?

Postgresql source code learning (33) - transaction log ⑨ - see the overall process of log writing from the insert record

Analysis of pseudo-classes and pseudo-elements

Leetcode952. 按公因数计算最大组件大小

Automatic translation software - batch batch automatic translation software recommendation

Difficulty comparison between high concurrency and multithreading (easy to confuse)

360推送-360推送工具-360批量推送工具
随机推荐
Run the NPM will pop up to ask "how are you going to open this file?"
Difficulty comparison between high concurrency and multithreading (easy to confuse)
【编程题】【Scratch三级】2022.03 冬天下雪了
LeetCode brush # 376 # Medium - swing sequence
关于求反三角函数的三角函数值
快速傅里叶变换(FFT)
数据库原理作业3 — JMU
【网络攻防】常见的网络攻防技术——黑客攻防(通俗易懂版)
试题 历届真题 错误票据【第四届】【省赛】【B组】
2.(1)栈的链式存储、链栈的操作(图解、注释、代码)
Bulk free text translation
DDL+DML+DQL
(border-box) The difference between box model w3c and IE
mysql的下载及安装使用
MySQL的触发器
数据库原理作业2 — JMU
高并发与多线程之间的难点对比(容易混淆)
事务的四大特性
英语翻译软件-批量自动免费翻译软件支持三方接口翻译
MySql的安装配置超详细教程与简单的建库建表方法