how to find the second highest salary from emp table?

Answer Posted / hari chaudhary

All My friend use this query then good result of your sql
database find in second or Third last data find.....

Select distinct(salary) From employee E1 Where
(n-1) = (Select Count(Distinct(E2.salary)) From employee E2
Where E2.salary > E1.salary)

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between join and natural join?

473


What is difference between stored procedures and application procedures?

568


what is the difference between clustered and non clustered index in sql? : Sql dba

549


what is the stuff function and how does it differ from the replace function? : Sql dba

623


What is an example of translating a date into julian format?

579






What is the difference among union, minus and intersect?

545


What does varchar include?

519


What is the difference between execution of triggers and stored procedures?

552


what are rollup and cube in t-sql? : Transact sql

659


What is the maximum rows in csv?

485


What are the advantages of stored procedure?

541


Is record in oracle pl sql?

532


Can we insert data into view?

526


How to fetch values from testtable1 that are not in testtable2 without using not keyword?

754


Can we use commit inside a trigger?

525