how to find the second highest salary from emp table?

Answer Posted / naveed saleh

You can use this for getting nth highest salary from
Employee table as follows

SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP n salary
FROM employee
ORDER BY salary DESC) a
ORDER BY salary
where n > 1 (n is always greater than one)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is $$ in sql?

555


Does mysql support pl sql?

624


What is audit logout in sql profiler?

592


What is Materialized View? In What Scenario we Use Materialized View?

8536


what are the differences between char and varchar? : Sql dba

529






What is the most common sql injection tool?

547


write an sql query to find names of employee start with 'a'? : Sql dba

583


How do you take the union of two tables in sql?

517


what is a join? : Sql dba

565


What is a primary key sql?

565


name 3 ways to get an accurate count of the number of records in a table? : Sql dba

572


what is the difference between a local and a global temporary table? : Sql dba

556


What is procedure function?

541


What is cte sql?

517


What can you do with pl sql?

569