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 salary?

Answers were Sorted based on User's Feedback



how to find the second salary?..

Answer / amruta dash

select max(salary) from tblname where salary not in (select
max(salary) from tblname);

Is This Answer Correct ?    23 Yes 1 No

how to find the second salary?..

Answer / vamsi krishna

For 2nd maximum salary
select Max(sal) from EMP a where 2=(select COUNT(distinct(sal)) from EMP b where a.SAL<=b.SAL);

Is This Answer Correct ?    14 Yes 3 No

how to find the second salary?..

Answer / rajkumar v

Select min(salary)FROM emp WHERE (salary IN (SELECT TOP 2
salary FROM emp ORDER BY salary DESC))

Is This Answer Correct ?    4 Yes 0 No

how to find the second salary?..

Answer / kavitha

select max(salary) from tablename where salary not in(select
max(salary) from tablename )

or


select max(salary) from tablename where salary <(select
max(salary) from tablename )

Is This Answer Correct ?    3 Yes 0 No

how to find the second salary?..

Answer / vishnu

Here we can find out 2nd highest salary in many ways,
according to the situation we can select anyone…
1st Type:
select min(esal) from emp where esal in (select top 2 esal
from emp order by esal desc)

2nd Type:
select max(esal) from emp where esal not in(select max(esal)
from emp)

3rd Type:
select max(esal) from emp where esal <(select max(esal) from
emp )

4th Type:
select Max(esal) from EMP a where 2=(select
COUNT(distinct(esal)) from EMP b where a.eSAL<=b.eSAL);

Is This Answer Correct ?    3 Yes 0 No

how to find the second salary?..

Answer / m.s.patil

select max(sal) from t1 where sal not in (27777);

27777 is max salary in table

Is This Answer Correct ?    3 Yes 1 No

how to find the second salary?..

Answer / sannnnnnnnnnn

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

Is This Answer Correct ?    1 Yes 0 No

how to find the second salary?..

Answer / raja

select top1 salary from(select distinct top2 salary from
table name order by salary desc)a order by salary

Is This Answer Correct ?    2 Yes 2 No

how to find the second salary?..

Answer / moorthy t

select n,* from(select rownum n,* from (select * from table
where group by (sal) order by (sal) desc)) where n=2;

Is This Answer Correct ?    0 Yes 2 No

how to find the second salary?..

Answer / sandeep rana

select max(salary) from salary_table where salary in(select
top 2 salary from salary_table order by salary desc)

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More SQL Server Interview Questions

Can we install sql server 2016 on windows 7?

0 Answers  


Which TCP/IP port does SQL Server run on?

2 Answers  


How many jobs will create for Mirroring, Log Shipping, and Transactional Replication?

4 Answers   IBM,


What is an index?

8 Answers   Yardi Software,


What is inline variable assignment?

0 Answers  


About DTS usage ?

2 Answers   Cognizant, Wipro,


Other than truncate statement, which other command can by-pass the trigger on the tables?

0 Answers  


Tell me what are cursors and when they are useful?

0 Answers  


Can one drop a column from a table?

0 Answers  


What is a group function explain with an example?

0 Answers  


How to fetch records from a One to Many relationship table. eg: wanna get details of all orders for a specific customer. (do not want repeatation of master table records for child table records)

2 Answers  


what is the difference between a primary key and a unique key? : Sql server database administration

0 Answers  


Categories