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...


how to find the second highest salary from emp table?

Answers were Sorted based on User's Feedback



how to find the second highest salary from emp table?..

Answer / anonymous

select Max(salary) from test where salary not in(select Max
(salary) from test);

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / hemant

select salary,empname from employee where
salary=(select max(salary) from employee where
salary<(select max(salary) from employee))

This query will produce all the result whose salary is
second highest.

1. A 20000
2. B 20000
3. C 20000
4. D 20000

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / boring guy

select max(sal) from emp where sal!=(select max(sal) from
emp)

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / adithya

select min(sal) from (select distict sal from emp where
rownum<3 order by sal desc)

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / pankaj raj patel

select max(salary ) from emp table where sal<(select max
(salary)from emp table)

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / kasiraya

SELECT SALARY
FROM
(
SELECT ROW_NUMBER() OVER( ORDER BY SALARY DESC) AS
SL_NO,SALARY
FROM EMP
ORDER BY SALARY DESC
)
WHERE SL_NO=2

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / dinesh rajput

select sal from(select sal from
(select distinct sal from emp order by sal desc)
where rownum<=2 order by sal asc)
where rownum=1;

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / vinodkumar

select *from(select *from emp orderby sal desc)where
ronum<=2 minus select *from (select *from emp order by sal
desc ) where rownum<=1;

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / bell

SELECT TOP 1 FieldName FROM (SELECT TOP 2 FieldName FROM
Tabname ORDER BY FieldName DESC) allis ORDER BY FieldName
ASC

Is This Answer Correct ?    0 Yes 0 No

how to find the second highest salary from emp table?..

Answer / ramu

selectename,sal from (select ename,sal from emp order by sal
desc) where rownum<=5;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

What is recursive stored procedure?

0 Answers  


Does sql*plus have a pl/sql engine?

0 Answers  


Why is nosql good?

0 Answers  


What is union, minus and interact commands?

0 Answers  


How do I add a primary key to a table?

0 Answers  


explain advantages of innodb over myisam. : Sql dba

0 Answers  


What is t sql used for?

0 Answers  


What can I use instead of union in sql?

0 Answers  


What is the process of copying data from table a to table b?

0 Answers  


what are the differences between require and include, include_once and require_once? : Sql dba

0 Answers  


What is an ndf file?

0 Answers  


What is the difference between anonymous block and named blocks?

3 Answers  


Categories