Print 3 highest salary

Answer Posted / saraswathi muthuraman

The previous post is to find the 3rd highest value.

Please find the below qry to find the top 3 highest salary

SQL> select a.EMP_NO,a.SAL,a.DEP_NO from emp_test a, (select
SAL,rank() over(order by sal desc) as rank_val from emp_test
group by sal)b where
2 a.sal=b.sal and b.rank_val <=3;

1003 20010 11
1001 10000 11
1001 10000 11
1002 100 11

4 rows selected.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I change the max connections in mysql?

460


Will mysql remain free?

502


How many entries can mysql handle?

500


What are the advantages of MySQL when compared with Oracle?

535


Can you tell how many values can set the function of mysql to consider?

519






How do I rename a table in mysql?

493


Can you tell what are various ways to create an index?

458


Can mysql store files?

494


Can mysql function return a table?

599


What is mysql root?

485


What is select query in mysql?

465


What can I do with mysql?

501


What is sql vs mysql?

522


how we will Show selected records sorted in an ascending (asc) or descending (desc).

543


How many queries can mysql handle?

493