find 2nd highest salary of person using cursor concept?
Answer Posted / 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 |
Post New Answer View All Answers
What is explicit cursors?
How to use subqueries in the from clause in ms sql server?
What do you understand by user-defined function in the sql server?
Can you name a few encryption mechanisms in sql server?
Why I have to use stored procedures?
your distribution database is full what will u do
can you implement data mining in SSRS?
Tell me what are the advantages of using stored procedures?
on line cluster can we make if yes tell me the procedure
How to divide query output into multiple groups with the group by clause in ms sql server?
How to create a simple user defined function in ms sql server?
How to turn off warning messages during php execution?
What are different types of schemas?
How many types of stored procedures are there in sql server?
How will you know when statistics on a table are obsolete?