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

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

Is This Answer Correct ?    7 Yes 9 No

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

Answer / babbu

it's easy with self join:
select max(sal) from emp e1,emp e2 where e1.sal < e2.sal

Is This Answer Correct ?    0 Yes 2 No

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

Answer / lakshminarayana reddy

select rownum,empno,ename,job,sal from emp(select
rownum,empno,ename,job,sal from emp order by sal desc) grop
by rownum,empno,ename,job,sal having rownum=2;

Is This Answer Correct ?    7 Yes 10 No

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

Answer / varun

select max(sal) from emp ((select sal from emp)-(select max
(sal) from emp))

Is This Answer Correct ?    5 Yes 8 No

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

Answer / naresh kumar kalangi

select top 1 * from (select top 2 * from emp order by sal
desc)s order by sal

Is This Answer Correct ?    5 Yes 8 No

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

Answer / surajit pathak

select * from emp e1
where 2>(select count(1) from emp e2
where e2.sal>e1.sal)
order by sal desc

Is This Answer Correct ?    1 Yes 4 No

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

Answer / satya_k21

Hi,


Select * from emp e where 2>= (select count(sal) from
emp e where sal>=e.sal) order by desc.

Let me know if it is wrong..


Regards,
Satya.K

Is This Answer Correct ?    11 Yes 16 No

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

Answer / rajesh.m

Crete Table Curtest(Emp char(40),salary money)
------------------------------------------------
Select Min(Salary) from Curtest where Salary
in (select Top 2 Salary from Curtest)

--------------------------------------------------

Is This Answer Correct ?    21 Yes 33 No

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

Answer / varun

select sal from emp where rownum=2 order by sal desc;

Is This Answer Correct ?    6 Yes 19 No

Post New Answer

More SQL PLSQL Interview Questions

what is the difference between join and union? : Sql dba

0 Answers  


What's the difference between a primary key and a clustered index?

0 Answers  


What is sqlcontext?

0 Answers  


Why use truncate instead of delete?

0 Answers  


what are the advantages of sql ? : Sql dba

0 Answers  


what are the t string functions available in tsql? : Transact sql

0 Answers  


How do you copy a table in sql?

0 Answers  


What types of commands can be executed in sql*plus?

0 Answers  


What is the difference between left join and left outer join?

1 Answers  


Main diff between varray and nested tablea

3 Answers   Polaris, TCS,


Is join same as left join?

0 Answers  


table - new_no old_no 2345 1234 3456 2345 5678 4567 output sud be -new_no 1234 2345 3456 4567 5678

2 Answers  


Categories