当前位置:网站首页>【无标题】
【无标题】
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边栏推荐
猜你喜欢
![[search topics] flood coverage of search questions after reading the inevitable meeting](/img/54/ce672d21a4a67110ee629dde3cb9dc.png)
[search topics] flood coverage of search questions after reading the inevitable meeting

Day 6 summary & database operation

Super potential public chain dfinity -- the best time for DFI developers to enter
![[freeswitch development practice] use SIP client Yate to connect freeswitch for VoIP calls](/img/8b/d5792a00fc5798d3d960f1f1b1088e.png)
[freeswitch development practice] use SIP client Yate to connect freeswitch for VoIP calls
![[database] gbase 8A MPP cluster v95 installation and uninstall](/img/56/c0dae30ba608842c1b92e914ef42fe.png)
[database] gbase 8A MPP cluster v95 installation and uninstall

Kotlin properties and fields

My meeting of OA project (query)

Day06 operation -- addition, deletion, modification and query

CSDN Top1 "how does a Virgo procedural ape" become a blogger with millions of fans through writing?

One click deployment of lamp and LNMP scripts is worth having
随机推荐
【数据库 】GBase 8a MPP Cluster V95 安装和卸载
PAT 甲级 A1013 Battle Over Cities
One click deployment of lamp and LNMP scripts is worth having
Ansible important components (playbook)
Recurrence of SQL injection vulnerability in the foreground of a 60 terminal security management system
unity TopDown角色移动控制
C Entry series (31) -- operator overloading
Cadence (x) wiring skills and precautions
Arbitrum Nova release! Create a low-cost and high-speed dedicated chain in the game social field
CSDN TOP1“一个处女座的程序猿“如何通过写作成为百万粉丝博主?
PAT 甲级 A1076 Forwards on Weibo
TCP solves the problem of short write
03异常处理,状态保持,请求钩子---04大型项目结构与蓝图
node的js文件引入
[search topics] flood coverage of search questions after reading the inevitable meeting
Human computer interaction software based on C language
In the first year of L2, the upgrade of arbitrum nitro brought a more compatible and efficient development experience
Okaleido launched the fusion mining mode, which is the only way for Oka to verify the current output
What are the differences in the performance of different usages such as count (*), count (primary key ID), count (field) and count (1)? That's more efficient
数据库操作 题目二