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


find 2nd highest salary of person using cursor concept?

Answers were Sorted based on User's Feedback



find 2nd highest salary of person using cursor concept?..

Answer / amruta dash

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

Is This Answer Correct ?    11 Yes 6 No

find 2nd highest salary of person using cursor concept?..

Answer / jcreddy

select e1.salary from employee e1
where 1 = (select count(salary) from employee e2 where
e1.salary < e2.salary)
order by marks asc
-- by changeing from '<', to '>' you will get min salary

Is This Answer Correct ?    4 Yes 0 No

find 2nd highest salary of person using cursor concept?..

Answer / manju

DECLARE authors_salary CURSOR
select top2(salary) from tb_employee order by desc salary

open author_salary
FETCH NEXT FROM authors_salary into @topsalary

Is This Answer Correct ?    4 Yes 1 No

find 2nd highest salary of person using cursor concept?..

Answer / krish

select max(sal) frem tbl where sal <(select max(sal) from tbl;

Is This Answer Correct ?    3 Yes 1 No

find 2nd highest salary of person using cursor concept?..

Answer / pawan

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

Is This Answer Correct ?    0 Yes 0 No

find 2nd highest salary of person using cursor concept?..

Answer / b.mamatha

select * from tabl1 where salary=(select max(salary) from
tabl1 where salary<(select max(salary) from tabl1)

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More SQL Server Interview Questions

What are the different ways of moving data/databases between servers and databases in SQL Server?

3 Answers   HCL,


What is the diff between Static Queries and Dynamic queries give me some examples

2 Answers   CSC,


How can we remove orphan records from a table?

0 Answers  


what information is maintained within the msdb database? : Sql server administration

0 Answers  


Explain the difference between cross join and full outer join?

0 Answers  


Without Using Cursors , How to Select the Selected row??

3 Answers   CarrizalSoft Technologies, Wipro,


Explain table valued parameters in sql server? Why tvp used?

0 Answers  


What is triggers and its types?

0 Answers  


Does partitioning help performance?

0 Answers  


List some of the rules that apply to creating and using a ‘view’

0 Answers  


A trigger can reference objects outside the current database? State true or false.

0 Answers  


What is the process of normalization?

0 Answers  


Categories