Pregunta de entrevista de Deloitte

How to get the second highest salary from the table?

Respuestas de entrevistas

Anónimo

1 abr 2022

SELECT * FROM employee ORDER BY SALARY DESC LIMIT 1,1

2

Anónimo

1 abr 2022

SELECT MAX(salary) AS salary FROM employee WHERE salary IN (SELECT salary FROM employee MINUS SELECT MAX(salary) FROM employee)