Query to select TOP 2 salary from employee table.
select * from employee order by salary desc limit 2
Query to select TOP N salary from employee table.
select * from employee order by salary desc limit N
Query to select 2nd Highest salary from employee table.
select min(SALARY) from (select * from employee order by salary desc limit 2) a
Query to select Nth Highest salary from employee table.
select min(SALARY) from (select * from employee order by salary desc limit N) a
Query to select First_Name, Last_Name from employee table as separate rows.
select FIRST_NAME from EMPLOYEE union select LAST_NAME from EMPLOYEE
Facebook Comments