http://softwareengineering.stackexchange.com/questions/123074/sql-triggers-and-when-or-when-not-to-use-them/123628#123628
http://stackoverflow.com/questions/3744209/mysql-stored-procedure-vs-function-which-would-i-use-when
https://dev.mysql.com/doc/sakila/en/
https://dev.mysql.com/doc/sakila/en/sakila-structure-functions-inventory_held_by_customer.html
https://dev.mysql.com/doc/index-other.html
Trigger is a special type of stored procedure that fires as a response of an event rather than be directly executed by the user like a normal procedure.
Commonly used for auditing.
Row and statement triggers
What to keep in mind using triggers
Procedures vs functions:
Prepared statements for faster performance