当前位置:网站首页>【无标题】
【无标题】
2022-07-26 08:53:00 【小唐学姐】
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 | +---------------------+
SELECT
IFNULL(
(SELECT DISTINCT Salary
FROM Employee
ORDER BY Salary DESC
LIMIT 1 OFFSET 1),
NULL) AS SecondHighestSalary边栏推荐
- Uploading pictures on Alibaba cloud OSS
- 03 exception handling, state keeping, request hook -- 04 large project structure and blueprint
- Database operation topic 1
- My meeting of OA project (query)
- Center an element horizontally and vertically
- Oracle 19C OCP 1z0-082 certification examination question bank (42-50)
- Neo eco technology monthly | help developers play smart contracts
- CSDN TOP1“一个处女座的程序猿“如何通过写作成为百万粉丝博主?
- [search topics] flood coverage of search questions after reading the inevitable meeting
- Oracle 19C OCP 1z0-082 certification examination question bank (30-35)
猜你喜欢

keepalived双机热备
![[database] gbase 8A MPP cluster v95 installation and uninstall](/img/56/c0dae30ba608842c1b92e914ef42fe.png)
[database] gbase 8A MPP cluster v95 installation and uninstall

Transfer guide printing system based on C language design

tcp 解决short write问题

pl/sql之集合-2

Set of pl/sql

Okaleido launched the fusion mining mode, which is the only way for Oka to verify the current output

NFT与数字藏品到底有何区别?

Study notes of automatic control principle --- stability analysis of control system

【数据库 】GBase 8a MPP Cluster V95 安装和卸载
随机推荐
The idea shortcut key ALT realizes the whole column operation
Pytoch realizes logistic regression
Rocky基础练习题-shell脚本2
day06 作业---技能题7
Ueditot_ JSP SSRF vulnerability recurrence
Study notes of automatic control principle --- stability analysis of control system
Probability model in machine learning
SSH,NFS,FTP
12306 ticket system crawling - 1. Saving and reading of city code data
187. Repeated DNA sequence
Hegong sky team vision training Day6 - traditional vision, image processing
QtCreator报错:You need to set an executable in the custom run configuration.
(1) CTS tradefed test framework environment construction
Datawhale panda book has been published!
Day06 homework -- skill question 2
PAT 甲级 A1013 Battle Over Cities
Overview of motion recognition evaluation
Typescript snowflake primary key generator
Database operation topic 2
Okaleido launched the fusion mining mode, which is the only way for Oka to verify the current output