Knowledge Walls
John Peter
Pune, Maharashtra, India
Trigger in Mysql of Code Template
1655 Views
CREATE TRIGGER
DELIMITER $$
CREATE TRIGGER trigger_name
[ BEFORE|AFTER ]  [ INSERT|UPDATE|DELETE ]
ON table_name FOR EACH ROW
BEGIN
      -- trigger statements
END
$$

-- trigger time
[ BEFORE|AFTER ] 

-- trigger event
[ INSERT|UPDATE|DELETE ]
SHOW TRIGGER
-- To show source of trigger
SHOW CREATE TRIGGER trigger_name;


-- Show all existing triggers
SHOW TRIGGERS;

SHOW TRIGGERS FROM db-name;
or
SHOW TRIGGERS IN db-name;

SHOW TRIGGERS FROM db-name LIKE '%table-name%'
or
SHOW TRIGGERS FROM db-name WHERE `table` = "table-name"
DROP TRIGGER
DROP TRIGGER trigger_name;
DROP TRIGGER IF EXISTS trigger_name;
Next
Next Topics
Next lessons of current book.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details