Write an SQL query to report the second highest salary from the Employee table. If there is no second highest salary, the query should report null.
CREATE TABLE Employee (
Id INT PRIMARY KEY,
Salary INT
);
-- Example 1: Insert data with multiple salaries
INSERT INTO Employee (Id, Salary) VALUES
(1, 100),
(2, 200),
(3, 300);
CREATE TABLE Employee2 (
Id INT PRIMARY KEY,
Salary INT
);
-- Example 2: Insert data with only one salary
INSERT INTO Employee2 (Id, Salary) VALUES
(1, 100);
Негізгі бет day 25:- Leet Code Problem 176. Second Highest Salary
Пікірлер