how to find the second highest salary from emp table?

Answer Posted / sagar

if the salary is simple non-duplicate salary, you can use
the below queries:

select max(sal) from emp where sal != (select max(sal) from emp)

you can also try

select sal from (select * from emp order by sal desc) where
rownum = 2

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

differentiate between float and double. : Sql dba

561


what is query cache in mysql? : Sql dba

577


Why coalesce is used in sql?

471


What is database migration?

519


Explain what is a field in a database and record in a database?

611






Is there a 64 bit version of ssms?

520


Can we change the table name in sql?

532


Is a table valued function object?

581


Can we use pl sql in mysql?

519


What are sql triggers used for?

515


What is primary key and foreign key with example?

496


What are literals in sql server?

534


what is union, minus and interact commands? : Sql dba

660


I need a function for a train ticket reservation please answer it thanks in advance

563


How do you write an inner join query?

515