MySQL 5.1 Reference Manual: "Stored Procedures, Functions, Triggers, and LAST_INSERT_ID()"
Read sections 18.3 and 18.4 for an overview of stored functions, triggers, and definer and invoker rights in RDMS. As you read compare and contrast the results that can be obtained utilizing Stored Functions in a Database System.