How To Create MySQL Trigger

This article will explain how to create Trigger in mysql. A mysql trigger is a procedural code which is automatically executed after response to certain events on a particular table or view in a database. I am taking a real time example here, when a new entry ( New Employee Joining) inserted in to employee table, then it should be also inserted in to salaries table.

There are three types of triggers supported by Mysql 5.0.2 versions. These are written bellow :

1) Mysql Insert Trigger
2) Mysql Update Trigger
3) Mysql Delete Trigger

Mysql Insert Trigger

Bellow is the syntax example to write Mysql insert trigger.

This is a sample mysql insert trigger example.

Mysql Update Trigger

Bellow is the syntax example to write Mysql Update trigger.

Mysql Delete Trigger

Bellow is the syntax example to write Mysql Delete trigger.

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

Article Tags: ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Solved Programs