Print 3 highest salary

Answer Posted / saraswathi muthuraman

SQL> desc emp_test;

Name
-----
EMP_NO SAL
DEP_NO

SQL> select * from emp_test;

1001 10000 11
1001 10000 11
1002 100 11
1003 20010 11
1004 99 11
1005 50 11
1006 25 11

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;

1002 100 11

1 row selected.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the function of myisamchk?

565


What is the data type for image?

617


What is the difference between char and varchar?

554


How to get the current date in mysql?

572


What is mvcc in mysql?

534






How do I create a mysql username and password?

500


What is 'mysqlcheck'?

575


What is data in mysql?

497


What is max_used_connections in mysql?

490


How does triggers work in mysql?

509


What is mysql database used for?

491


How do I start and stop mysql server?

480


What are the mysql database files stored in system ?

506


Is microsoft sql same as mysql?

512


What is the maximum no of columns a table can have?

471