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


Please Help Members By Posting Answers For Below Questions

Is sql server difficult to learn?

518


What is the difference between NOROW and LOCKROW?

2228


What is difference between createstatement and preparedstatement?

533


Is it possible to import data directly from t-sql commands without using sql server integration services? If so, what are the commands?

842


What do you mean by SQL injection attack?

609






what's the information that can be stored inside a bit column? : Sql server database administration

525


How many types of relations are there between dimension and measure group? : sql server analysis services, ssas

749


What is the significance of master, tempdb and model databases?

523


Explain different types of Normalization.

593


What is star, snowflake and star flake schema? : sql server analysis services, ssas

647


What are the database roles? : sql server security

555


Why use view instead of a table?

512


How to find the second highest salary of an employee?

582


If I delete a template from the list in sql studio, will it be deleted from the hard disk? : sql server management studio

551


Describe in brief sql server monitoring ways.

583