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


Write a query to get 2nd maximum salary in an employee table ?

Answers were Sorted based on User's Feedback



Write a query to get 2nd maximum salary in an employee table ?..

Answer / m

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

Is This Answer Correct ?    222 Yes 39 No

Write a query to get 2nd maximum salary in an employee table ?..

Answer / kotravel. b

SELECT MAX(SAL) FROM EMPLOYEE WHERE SAL<(SELECT MAX(SAL)
FROM EMPLOYEE);



THIS will surly give 2^nd max sal ok this correct ans ok....

Is This Answer Correct ?    85 Yes 13 No

Write a query to get 2nd maximum salary in an employee table ?..

Answer / anil_abbireddy

select * from emp a where 2=(select count(distinct sal)
from emp b where a.sal<=b.sal)

Is This Answer Correct ?    44 Yes 12 No

Write a query to get 2nd maximum salary in an employee table ?..

Answer / sohail

select empno,ename,sal
from (select ename,empno,sal,dense_rank()
over(order by sal desc)topn
from emp)
where topn=2

Is This Answer Correct ?    69 Yes 46 No

Write a query to get 2nd maximum salary in an employee table ?..

Answer / anil_abbireddy

select * from emp a where 2=(select count(distinct sal)
from emp b where a.sal<=b.sal)

Is This Answer Correct ?    30 Yes 8 No

Write a query to get 2nd maximum salary in an employee table ?..

Answer / venkat

select max(sal) from emp where sal<(select max(sal) from
emp);

Is This Answer Correct ?    19 Yes 5 No

Write a query to get 2nd maximum salary in an employee table ?..

Answer / khandu shinde

select a.sal
from (
select sal ,rownum no
from (
select distinct sal
from emp
order by sal desc
)
) a
where a.no=2

Is This Answer Correct ?    16 Yes 6 No

Write a query to get 2nd maximum salary in an employee table ?..

Answer / abhay

Select Max(Sal)
From Emp E
Where E.Sal < (Select Max(Sal) From Emp)

Is This Answer Correct ?    9 Yes 1 No

Write a query to get 2nd maximum salary in an employee table ?..

Answer / uday

Hi friends i think it is surely work because i worked for this.

select * from emp e where 1=(select count(distinct d.esal)
from emp d where d.esal>e.esal)

any one plz try if it's not work

plz let me know.
uday_testing@yahoo.co.in

Is This Answer Correct ?    7 Yes 3 No

Write a query to get 2nd maximum salary in an employee table ?..

Answer / wei

The best answer should be the first one, this is because
the sql statement accesses table emp only once.

Is This Answer Correct ?    9 Yes 6 No

Post New Answer

More SQL PLSQL Interview Questions

Explian rowid, rownum?

0 Answers  


When is the explicit cursor used ?

0 Answers  


What is sql analyzer?

0 Answers  


How to load data with sql*loader?

0 Answers  


What is materialized view in sql?

0 Answers  


Explain isolation levels. : Transact sql

0 Answers  


Inline the values in PL/SQL, what does it mean.?

0 Answers   MCN Solutions,


How are sql commands classified?

0 Answers  


Can we create table in function?

0 Answers  


How many postgresql users are there, worldwide?

0 Answers  


What version is sql?

0 Answers  


Is sql a dbms?

0 Answers  


Categories