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 / r.arjunarao

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

Is This Answer Correct ?    0 Yes 0 No

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

Answer / rakesh a.

select Amount from PurchaseOrderDetail pod where
1=(select COUNT(amount) from PurchaseOrderDetail pod2 where pod2.Amount>pod.Amount)

Is This Answer Correct ?    0 Yes 0 No

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

Answer / jayshree

select max(sal) from table_name where sal not in (select
max(sal) from table_name)

Is This Answer Correct ?    0 Yes 0 No

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

Answer / tanmoy

SELECT MIN(sal) FROM (SELECT sal FROM emp ORDER BY sal DESC LIMIT 2) AS a ;

Is This Answer Correct ?    0 Yes 0 No

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

Answer / surya

Select max(sal) from employee where sal not in(select max
(sal) from employee)

Is This Answer Correct ?    0 Yes 0 No

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

Answer / hemanth kumar

select salary from employees where rowid=(select rowid from
employees where rownum<=2
minus
select rowid from employees where rownum<2)
order by salary

Is This Answer Correct ?    0 Yes 0 No

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

Answer / manoj

select * from emp
where
sal=(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 / vinod dubey

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

it will defiantly work

best of luck

Is This Answer Correct ?    0 Yes 0 No

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

Answer / nevin

select min(salary) from (select top 2 sal from table_name order by sal desc)salary

Is This Answer Correct ?    0 Yes 0 No

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

Answer / ram achare

for 2nd highest salary
select sal from(select distinct sal from emp order by sal desc limit 2)emp order by salary limit 1;
for 3rd highest salary
select sal from(select distinct sal from emp order by sal desc limit 3)emp order by salary limit 1;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

What is a ddl command?

0 Answers  


Which one is better sql or oracle?

0 Answers  


What is scalar and vector?

0 Answers  


What is clustered, non-clustured and unique index. How many indexes can be created on a table ?

3 Answers   TCS,


how to create a database in oracle?

3 Answers  


can we update a view which is created from two tables

11 Answers  


suppose I have two table one Emp and other is dpt. Emp table has a field ,dept id,name ,sal and dpt table has a field dept id,dept name. Now I want to find out the emplyee list whose sal is between 2000-3000 from dept x.

7 Answers   Geometric Software, IBM,


Can we use pl sql in mysql?

0 Answers  


How can we make an if statement within a select statement?

0 Answers  


Does mysql_real_escape_string prevent sql injection?

0 Answers  


What is a procedure in pl sql?

0 Answers  


What are sql built in functions?

0 Answers  


Categories