当前位置:网站首页>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
边栏推荐
猜你喜欢
文件 - 05 下载文件:根据文件Id下载文件
Basic usage of Koa framework
零样本学习&Domain-aware Visual Bias Eliminating for Generalized Zero-Shot Learning
In-depth analysis of z-index
Conditional statements of shell (test, if, case)
文件 - 04 下载文件: 根据文件下载链接下载文件
360推送-360推送工具-360批量推送工具
【Go】Go 语言切片(Slice)
批量免费文字翻译
解决安装 Bun 之后出现 zsh compinit: insecure directories, run compaudit for list. Ignore insecure directorie
随机推荐
英语翻译软件-批量自动免费翻译软件支持三方接口翻译
【Star项目】小帽飞机大战(八)
Core Tower Electronics won the championship in the Wuhu Division of the 11th China Innovation and Entrepreneurship Competition
Exam Questions Previous True Questions Wrong Bills [The Fourth Session] [Provincial Competition] [Group B]
【微服务】Nacos集群搭建以及加载文件配置
解决安装 Bun 之后出现 zsh compinit: insecure directories, run compaudit for list. Ignore insecure directorie
Analysis of pseudo-classes and pseudo-elements
【愚公系列】2022年07月 Go教学课程 022-Go容器之字典
tidyverse笔记——dplyr包
【Go】Go 语言切片(Slice)
事务的四大特性
leetcode 406. Queue Reconstruction by Height 根据身高重建队列(中等)
自动翻译软件-批量批量自动翻译软件推荐
mysql索引失效的常见9种原因详解
Chapter 17: go back to find the entrance to the specified traverse, "ma bu" or horse stance just look greedy, no back to search traversal, "ma bu" or horse stance just look recursive search NXM board
数据库原理作业2 — JMU
Log4net 思维导图
【编程题】【Scratch三级】2022.03 冬天下雪了
拉格朗日插值及其应用
高并发与多线程之间的难点对比(容易混淆)