Stored Procedure Overview
Stored procedures are precompiled collections of SQL statements stored on the server, allowing for encapsulated logic, parameterized execution, and improved application performance.
Creating a Stored Procedure
DELIMITER //
CREATE PROCEDURE Reset_animal_count()
MODIFIES SQL DATA
UPDATE animal_count SET animals = 0;
//
DELIMITER ;SELECT * FROM animal_count;
+---------+
| animals |
+---------+
| 101 |
+---------+
CALL Reset_animal_count();
SELECT * FROM animal_count;
+---------+
| animals |
+---------+
| 0 |
+---------+Why use Stored Procedures?
Stored Procedure listings and definitions
Dropping and Updating a Stored Procedure
Permissions in Stored Procedures
Last updated
Was this helpful?

