Mysql Triggers Tutorial | Mysql Trigger Before Insert
May 17, 2021
Trigger:-
- It is a special type of stored procedure that is invoked automatically in response to an event.
- Each trigger is associated with a table, which is activated on any DML statement such as INSERT, UPDATE, or DELETE.
Use of triggers in mysql
- Triggers help us to validate data even before they are inserted or updated
- Triggers increases the performance of SQL queries because it does not need to compile each time the query is executed.
Syntax
CREATE TRIGGER trigger_name trigger_time trigger_event
ON table_name FOR EACH ROW
BEGIN
— variable declarations
— trigger code
END;
Example
Check Complete Tutorial Click Here