Stored Procedure
A stored procedure executes application logic directly inside the RDBMS server.
Reasons for stored procedures:
- Reduces volume of data transfer between client and server
- Centralizes application code at the server
- Conceptual schema enhancement
Atomic-Valued Function
Function returns a single scalar value.
Then, you can run this as a query
Table-Valued Function
Function returns a table.
Stored Procedure with Branching