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
Is sql server difficult to learn?
What is the difference between NOROW and LOCKROW?
What is difference between createstatement and preparedstatement?
Is it possible to import data directly from t-sql commands without using sql server integration services? If so, what are the commands?
What do you mean by SQL injection attack?
what's the information that can be stored inside a bit column? : Sql server database administration
How many types of relations are there between dimension and measure group? : sql server analysis services, ssas
What is the significance of master, tempdb and model databases?
Explain different types of Normalization.
What is star, snowflake and star flake schema? : sql server analysis services, ssas
What are the database roles? : sql server security
Why use view instead of a table?
How to find the second highest salary of an employee?
If I delete a template from the list in sql studio, will it be deleted from the hard disk? : sql server management studio
Describe in brief sql server monitoring ways.