how to retrieve the top 2 salaried persons from a database?

Answer Posted / srinivas

select * from emp m
where
(select count(distinct sal)+1 from emp s
where s.sal>m.sal)<=2
order by sal desc

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 a constraint? Tell me about its various levels. : Sql dba

735


How to write a query to show the details of a student from students table whose

755


How many disk partitions should I have?

719


How to disable a trigger name update_salary?

895


What is equi join in sql?

799






What is a pragma statement?

955


Is primary key clustered or nonclustered?

741


Enlist the characteristics of pl/sql?

1491


What is the purpose of the sql select top clause?

738


how to convert character strings to dates? : Sql dba

718


How can I see all tables in sql?

727


what is not null constraint? : Sql dba

723


what are wild cards used in database for pattern matching ? : Sql dba

758


Why is theta join required?

834


What are sql functions? Describe the different types of sql functions?

756