Multiple Triggers

In this lesson, we will see how to write multiple triggers for a table which have the same action time and event.

We'll cover the following

Multiple Triggers

It is possible to create triggers on a table whose action time and event are the same. Such triggers are fired in a sequence that is specified at the time of creation of the triggers. The FOLLOWS and PRECEDES keywords are used to define the sequence in which triggers associated with a table having the same action time and event execute.

Syntax

CREATE TRIGGER trigger_name [BEFORE | AFTER] [INSERT | UPDATE | DELETE]

ON table_name

[FOLLOWS | PRECEDES] existing_trigger_name

FOR EACH ROW

trigger_body

Connect to the terminal below by clicking in the widget. Once connected, the command line prompt will show up. Enter or copy-paste the command ./DataJek/Lessons/50lesson.sh and wait for the mysql prompt to start-up.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.