Home > Blockchain >  I'm trying to get second heights salary but not able to fetch record from database
I'm trying to get second heights salary but not able to fetch record from database

Time:11-29

SELECT MAX(SALARY) FROM Employee WHERE SALARY >= (SELECT MAX(SALARY) FROM Employee);

Above is my SQL query, I try multiple time how to fetch the data of second heights salary. But getting invalid response of query.

I'm expecting show the second heights salary from the 10k user. Those who have second heights salary. Please help to solve that. Its my task from interview.

CodePudding user response:

SELECT MAX(SALARY) FROM Employee WHERE SALARY < (SELECT MAX(SALARY) FROM Employee);

replace your query

  • Related