当前位置:网站首页>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
边栏推荐
- MySQL笔记下
- Postgresql source code learning (33) - transaction log ⑨ - see the overall process of log writing from the insert record
- Run the NPM will pop up to ask "how are you going to open this file?"
- Some derivation formulas for machine learning backpropagation
- 完美指南|如何使用 ODBC 进行无代理 Oracle 数据库监控?
- HighTec 的安装与配置
- 04-SDRAM:读操作(突发)
- Bulk free text translation
- 多进程全局变量失效、变量共享问题
- Database Principles Homework 2 — JMU
猜你喜欢
Run the NPM will pop up to ask "how are you going to open this file?"
2.(1)栈的链式存储、链栈的操作(图解、注释、代码)
Analysis of the implementation principle and detailed knowledge of v-model syntactic sugar and how to make the components you develop support v-model
DirectExchange交换机简单入门demo
Zotero | Zotero translator plugin update | Solve the problem that Baidu academic literature cannot be obtained
【微服务】(十六)—— 分布式事务Seata
shell之条件语句(test、if、case)
Project exercise - memorandum (add, delete, modify, check)
【Go】Go 语言切片(Slice)
Basic usage of Koa framework
随机推荐
【Go报错】go go.mod file not found in current directory or any parent directory 错误解决
【Go】Go 语言切片(Slice)
电压源的电路分析知识分享
opencv、pil和from torchvision.transforms的Resize, Compose, ToTensor, Normalize等差别
毫米波技术基础
Basic usage of Koa framework
【解决】npm ERR A complete log of this run can be found in npm ERR
嵌入式系统驱动初级【2】——内核模块下_参数和依赖
服务器和客户端信息的获取
04-SDRAM: Read Operation (Burst)
Foreign trade website optimization - foreign trade website optimization tutorial - foreign trade website optimization software
Install and use uView
什么是半波整流器?半波整流器的使用方法
【Star项目】小帽飞机大战(七)
Redux state management
360 push-360 push tool-360 batch push tool
codec2 BlockPool:unreadable libraries
搭建zabbix监控及邮件报警(超详细教学)
【面试:并发篇38:多线程:线程池】ThreadPoolExecutor类的基本概念
2.(1)栈的链式存储、链栈的操作(图解、注释、代码)