Mysql Triggers Tutorial | Mysql Trigger Before Insert

Digital Classes
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

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response