Thursday 9 February 2017

How would I find the second largest salary from the employee table?

Simple Approach ::
SELECT max(salary)
FROM emptable
WHERE salary < (SELECT max(salary)
                FROM emptable);
Alternate Approach ::
SELECT sal
FROM emp
ORDER BY sal DESC
LIMIT 1, 1;

1 comment:

  1. wow ! nice post Indian Cyber Army gives the best in the Cyber crime investigation. We have put our foot one-step forward launching an effective Summer Internship program.The Summer Internship 2018 registrations are open for 2nd batch starting from 2 July 2018. Our standard services of Cyber Crime Investigation are class apart owing to years of proficiency. We provide Advanced Cyber Security, Ethical Hacking, Digital Forensics, etc. trainings to keep India totally secure from the Cyber Offenders.

    ReplyDelete