
Mysql | Trigger
The trigger can be defined as a database object just like a stored procedure. It is a set of actions that fires automatically when an event occurs in a database.
Triggers are, in fact, written to be executed in response to any of the following events −
- A database manipulation (DML) statement (DELETE, INSERT, or UPDATE)
- A database definition (DDL) statement (CREATE, ALTER, or DROP).
- A database operation (SERVERERROR, LOGON, LOGOFF, STARTUP, or SHUTDOWN).
create trigger insert_emp_status
on emp
after insert
as
begin
insert into empstatus values('active')
end