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


To find second largest salary in Employee table

Answers were Sorted based on User's Feedback



To find second largest salary in Employee table..

Answer / anil

select max(salary) from tbl_employee where salay <(select max(salary) from tbl_employee)

Is This Answer Correct ?    30 Yes 6 No

To find second largest salary in Employee table..

Answer / saravanakumar

SELECT MAX(SALARY) FROM EMPLOYEE WHERE SALARY NOT IN
(SELECT MAX(SALARY) FROM EMPLOYEE)

Is This Answer Correct ?    13 Yes 1 No

To find second largest salary in Employee table..

Answer / ram

select *from emp e where &n in(select count(distinct sal)
from emp m where e.sal<=m.sal);

which will ask's u like :

enter the value for n : 2 (enter 2)
gives u second highest.

Is This Answer Correct ?    4 Yes 0 No

To find second largest salary in Employee table..

Answer / amit

select max(salary) from employee where salary != (select max
(salary) from employee)

Is This Answer Correct ?    4 Yes 1 No

To find second largest salary in Employee table..

Answer / vikas kant

select Top 1 salary from emp_Table where salary in(select
Top 2 Salary from emp_Table order by salary desc)

Is This Answer Correct ?    6 Yes 4 No

To find second largest salary in Employee table..

Answer / zulfikar ali

SELECT MAX(SALARY)
FROM EMPLOYEE
WHERE SALARY NOT IN(SELECT TOP 1 SALARY FROM EMPLOYEE ORDER
BY SALARY DESC)

Is This Answer Correct ?    2 Yes 1 No

To find second largest salary in Employee table..

Answer / padmapriya

Thanks every one who replied for my question.

Is This Answer Correct ?    1 Yes 0 No

To find second largest salary in Employee table..

Answer / v rajkumar

Select min(salary)FROM emp WHERE salary IN (SELECT distinct
TOP 2 salary FROM emp ORDER BY salary desc)
OR
Select top 1 salary from (select distinct top 2 salary from
emp order by salary desc) emp order by salary

OR
select max(salary) from emp where salary <(select max
(salary) from emp)

Is This Answer Correct ?    1 Yes 0 No

To find second largest salary in Employee table..

Answer / satish

select salary from emp_Table_1 where 2= (select count(*)
form emp_Table_2 where emp_Table_2.salary < emp_Table_1.salary)

-satish

Is This Answer Correct ?    2 Yes 2 No

To find second largest salary in Employee table..

Answer / mohammad murtuza ali

select salary from employeetable where empsal is < max(salary)

Is This Answer Correct ?    4 Yes 4 No

Post New Answer

More SQL Server Interview Questions

can you any body tell me the how to decrease the logfile

4 Answers  


what are the different ways of moving data/databases between servers and databases in sql server? : Sql server database administration

0 Answers  


Difference between group by clause and having clause in SQL?

0 Answers   Flextronics,


What is a Lock and let me know Different types of locks?

2 Answers  


What is #temp and @table variable in SQL server?

0 Answers  


What are different types of data sources?

0 Answers  


What are the types of indexes?

0 Answers  


What is normalization of database? What are its benefits?

0 Answers  


Can we call a function that has out parameter in select statement

0 Answers   Nagarro,


What are difference between Cluster index and Non-Cluster index?

0 Answers   QuestPond,


How sql server executes a statement with nested subqueries?

0 Answers  


How to read data in a table with "select" statements?

0 Answers  


Categories