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

Write a pl/sql script to display the following series of numbers: 99,96,93……9,6,3?

1 Answers  


Difference between aggregate function and analytical function?

3 Answers   Metric Stream,


How do I add a database to sql?

0 Answers  


What is the difference between local variables and global variables?

0 Answers  


What is the best free sql database?

0 Answers  


Explain ddl statements in pl/sql?

0 Answers  


How do you create a unique index?

0 Answers  


What operating systems are supported by oracle sql developer?

0 Answers  


Why coalesce is used in sql?

0 Answers  


If you want a column to be part of the result set, after which SQL keyword does it belong? 1. SELECT 2. FROM 3. WHERE 4. GROUP BY 5. HAVING

10 Answers   HCL, TCS,


How to revise and re-run the last sql command?

0 Answers  


Is it possible to sort a column using a column alias?

0 Answers  


Categories