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 denormalization in a database?

587


What is the starting oracle error number?

562


Is there a 64 bit version of ssms?

516


What is clustered index sql?

501


What is the difference between sql and mysql?

551






What is sqlservr exe?

478


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

500


How do you modify a column in sql?

530


How many commands are in sql?

523


what is myisam? : Sql dba

574


What can sql server reporting services do?

578


What are packages in pl sql and also explain its advantages?

532


What is parallel hint?

746


Explain the significance of the & and && operators in pl sql.

567


What is sqlcommand?

548