Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

replace your query

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading