How to create triggers in MySQL?

Answer Posted / hrindows@gmail.com

We can use the CREATE TRIGGER statement for creating a new trigger in MySQL.

SYNTAX:
CREATE TRIGGER trigger_name
(AFTER | BEFORE) (INSERT | UPDATE | DELETE)
ON table_name FOR EACH ROW
BEGIN
--variable declarations
--trigger code
END;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does it mean to be case sensitive?

469


What is pragma serially_reusable and why is it used?

472


Where the database is stored in mysql?

489


How to add a new column to an existing table in mysql?

522


Can you tell what are various ways to create an index?

456






What is user in mysql?

434


Explain the difference between primary key and candidate key in mysql?

510


How to rename an existing table in mysql?

529


How do I connect to a mysql database?

483


How do I connect to a database in mysql workbench?

542


How will you export tables as an xml file in mysql?

462


How do I start mysql from command line?

503


What is dirty read and phantom read?

441


How to delete a database from mysql server.

512


How to dump a table to a file with 'mysqldump'?

519