12/9/2016 - 7:48 AM

mysql unfinished notes

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:

  • (stored) functions can be used in ordinary SQL, procedures can't
  • procedure doesn't return a value. it's invoked (called) to perform an operation (like modifying a table, processing retrieved records ..)
  • while function returns a single value directly to the caller to be used in the expression

Prepared statements for faster performance

  • can be used in procedures, but not functions or triggers