Stored Procedure

What is Stored procedure?


A stored procedure is a set of Structured Query Language (SQL) statements that you assign a name to and store in a database in compiled form so that you can share it between a number of programs.

* They allow modular programming.
* They allow faster execution.
* They can reduce network traffic.
* They can be used as a security mechanism.




Query to find 5th Highest Salary from Employee Table:



SELECT TOP 1 salary
FROM
(
SELECT DISTINCT TOP 5 salary
FROM Employee
ORDER BY salary DESC
) a

ORDER BY salary

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.