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
How to convert a table data in XML format in sql server?
Can we delete data from a view?
Explain Capacity planning to create a database? and how to monitor it?
How many full-text indexes can a table have?
Can I disable or restrict ssrs export formats (rendering formats)?
How to delete duplicate rows from table except one?
Explain the concepts and capabilities of sql server?
Define primary key?
What structure can you implement for the database to speed up table reads?
What is difference between count (*) and count 1?
You have a stored procedure, which execute a lengthy batch job. This stored procedure is called from a trigger you do not want to slow the data entry process you do not want trigger to wait for this batch job to finish before it completes itself what you can do to speed up the process?
What are data files?
What are the differences between triggers and stored procedures?
How do I find the default sql server instance?
What is openrowset sql server?