Key Ideas
1Stored Procedures — Reusable SQL Routines. A stored procedure is a named block of SQL saved on the database server. Call it with CALL. It can accept IN parameters (input) and OUT parameters (output).
2OUT Parameters. OUT parameters allow a procedure to return a value back to the caller. Store the result in a session variable prefixed with @.
3Stored Functions. A stored function is like a procedure but it returns a single value and can be called inside a SELECT statement. The DETERMINISTIC keyword tells MySQL the same inputs ...
4ACID Transactions. A transaction groups multiple SQL statements into an atomic unit — either all succeed (COMMIT) or all are undone (ROLLBACK). The ACID properties define what makes a tr...
5Triggers — Auto-Firing SQL. A trigger automatically executes a block of SQL before or after an INSERT, UPDATE, or DELETE on a table — without any explicit CALL.