Write a query to get 2nd maximum salary in an employee table ?

Answer Posted / anil_abbireddy

select * from emp a where 2=(select count(distinct sal)
from emp b where a.sal<=b.sal)

Is This Answer Correct ?    44 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use sqlite?

529


What is %s in sql?

562


What is indexes?

540


Why should I use postgresql?

561


how to get @@error and @@rowcount at the same time? : Sql dba

525






How to write html code in pl sql?

580


What is the difference between clustered and non-clustered indexes?

601


Can you call pl/sql package functions from within a fast formula?

560


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

750


How can we avoid duplicating records in a query?

562


What is the plv (pl/vision) package offers?

614


What is data definition language?

619


Why do we create stored procedures & functions in pl/sql and how are they different?

500


What are the different schemas objects that can be created using pl/sql?

526


What is composite data type in pl sql?

554