Today I learned bout Triggers in MySql, Triggers are programmable events that react to queries and reside directly on the database server. Triggers can be executed before or after INSERT, UPDATE or DELETE statements.
with triggers, we can know what data has been insert, update or delete. actually it's easy to create, this is the example:
CREATE TRIGGER newsCounter AFTER INSERT ON News FOR EACH ROW BEGIN INSERT INTO NewsCount (newsItemCount) (SELECT count(*) FROM News); END;
| DELIMITER ;
that example, is to get and insert the news count at NewsCount table when user insert at News table
and to get a triggers list at your database, you can run this: SHOW TRIGGERS;