Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Print 3 highest salary

Answers were Sorted based on User's Feedback



Print 3 highest salary..

Answer / manish nautiyal

select salary from table_name order by salary desc limit 3;

Is This Answer Correct ?    35 Yes 4 No

Print 3 highest salary..

Answer / priya

select top 1 salary from ( select top 3 salary from ( select
distinct salary from employee order by desc ) order by asc);

Is This Answer Correct ?    7 Yes 1 No

Print 3 highest salary..

Answer / john peter

select salary from tablename order by salary desc limit 3;

Is This Answer Correct ?    6 Yes 1 No

Print 3 highest salary..

Answer / m gangadhar

select * from (select a.* from employees a order by
a.salary desc) where rownum <= 5

Is This Answer Correct ?    7 Yes 5 No

Print 3 highest salary..

Answer / 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

Print 3 highest salary..

Answer / 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

Print 3 highest salary..

Answer / satya

SELECT salary FROM emp order by ordering DESC limit 2,1

Is This Answer Correct ?    0 Yes 1 No

Print 3 highest salary..

Answer / lokesh das

Using a single query not sub-query

SELECT * FROM `employee` ORDER BY salary DESC LIMIT 2, 1

Is This Answer Correct ?    0 Yes 2 No

Print 3 highest salary..

Answer / ankammarao.v

select min(EmpSal) as sal3 from EmpInfo
where EmpSal in(select distinct top 3 EmpSal from Empinfo
order by EmpSal desc)

Is This Answer Correct ?    7 Yes 15 No

Post New Answer

More MySQL Interview Questions

How to shut down the server with 'mysqladmin'?

0 Answers  


What is pdo in php mysql?

0 Answers  


What is difference between mysql and mysqli?

0 Answers  


What are the features of mysql?

0 Answers  


How to enable or disable a row of a table using MySQL in struts?

0 Answers  


how to delete duplicate rows in sql server 2005?

2 Answers   EWIT, Reliance,


What is cursor in mysql?

0 Answers  


How would you backup and restore a big MySQL database? What are the advantages of the approach which you have taken over the others?

4 Answers  


What is the use of i-am-a-dummy flag in mysql?

0 Answers  


which version of mysql can't support stored procedure??

3 Answers  


How do you login to MySql using Unix shell?

0 Answers  


What is difference between Sql server and MySql database? It may be silly question but i really dont know.

0 Answers  


Categories