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

What are the query optimization techniques?

513


what are the differences between binary and varbinary? : Sql dba

509


What is an inner join sql?

523


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

530


Can I call a procedure inside a function?

530






Explain how can you save or place your msg in a table?

575


What is a sql driver?

505


Why do we need view in sql?

530


What is group by in sql?

524


What is union and union all keyword in sql and what are their differences?

551


What is the cause of mutating table error and how can we solve it?

576


What is the difference between nvl function, ifnull function, and isnull function?

565


what is try_catch block in procedure

1168


Can we join 3 tables in sql?

468


What are the types of queries in sql?

500