Pergunta de entrevista da empresa AlertEnterprise

Write a SQL query to find the second highest salary from an Employees table. EmployeeID | Name | Salary -----------|---------|-------- 1 | Rahul | 50000 2 | Anjali | 70000 3 | Rohan | 60000 4 | Sneha | 80000

Resposta da entrevista

Sigiloso

29 de set. de 2025

SELECT DISTINCT Salary FROM Employees ORDER BY Salary DESC LIMIT 1 OFFSET 1; Explanation: ORDER BY Salary DESC → sorts salaries in descending order. LIMIT 1 OFFSET 1 → skips the highest salary and returns the next one. Output: 70000