---
title: "Trigger in MYSQL"  
description: "A trigger in MySQL is a database object that is associated with a table. A   									trigger is fired, when a particular event occurs for the table."  
author: "Uttam Misra"  
published: 2011-04-23  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/141/trigger-in-mysql  
category: "database"  
tags: ["database"]  
reading_time: 1 minute  

---

# Trigger in MYSQL

A [trigger](https://www.mindstick.com/blog/167/triggers-in-wpf) in [MySQL](https://www.mindstick.com/articles/12156/what-is-mysql) is a [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax) object that is associated with a table. A trigger is fired, when a particular event occurs for the table. [Triggers](https://www.mindstick.com/articles/337000/what-are-sql-triggers-and-ways-of-using-them-effectively) are used to perform [validation](https://www.mindstick.com/articles/12234/validation-using-data-annotation-using-entity-framework) checks on data [values](https://www.mindstick.com/forum/327/sum-textbox-values) for insertion or to perform calculations on values for updation.

They are 2 types of triggers – Before Trigger and After Trigger. Before Trigger fires before the [execution](https://www.mindstick.com/blog/178/synchronous-and-asynchronous-command-execution-in-c-sharp-dot-net) of [INSERT](https://www.mindstick.com/blog/173/executing-insert-delete-or-update-query-in-sqlserver-using-ado-dot-net), [DELETE](https://www.mindstick.com/forum/33620/how-to-delete-record-from-list-in-mvc-using-ajax) and [UPDATE](https://www.mindstick.com/forum/265/ajax-update-panel) commands. After trigger fires after the execution of INSERT, DELETE and UPDATE commands.

---

Original Source: https://www.mindstick.com/blog/141/trigger-in-mysql

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
