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
Does server sql treat char as a variable-length or fixed-length column?
Is sql server is free?
How to get the number of affected rows?
Your company has 50 branches all over the country all the branches, including the head office have sql server as the database every night all 50 branches upload certain information to the head office which replication topology is best suited for the above scenario?
In which format does an image save in SQL Server database ?
Can we update data in a view?
Can two tables share a primary key?
Can we add a cpu to sql server?
Explain primary key, foreign key and unique key?
What is the difference between seek predicate and predicate?
Explain the steps needed to create a scheduled job?
Where is my database stored on the hard disk in ms sql server?
How do I partition a table in sql server?
What do you mean by a dependent functionality in a build?
What is the difference between resultset and resultsetmetadata?