English Grammar and
Examples
Idioms
Jargon
Body language
MYSQL
Show Function Status
Show Index
Show Master Status
Show Privileges
Show Procedure Code
Show Procedure Status
Show Privileges
Show Profile
Show Profiles
Show Slave Status
Show Status
Show Triggers
Show Variables
Show Function Code
Call
Drop Function
Insert
Install Plugin
Load data infile
Replace
Set
Show Authors
Show Innodb Status
Show Open Tables
Show Plugins
Show Scheduler Status
Show Slave Hosts
Show Table Status
Show Tables
Show Warnings
Uninstall Plugin
Update
Show Create View
Show Databases
Show Engine

Full list of MYSQL
   Business Letters   Personal Letters   Resumes   CVs and more
       Facebook Example of create trigger mysql LINKED IN Example of create trigger mysql del-icio-us Example of create trigger mysql

Example Of CREATE TRIGGER Mysql Syntax:




CREATE [DEFINER = { user | CURRENT_USER }] TRIGGER trigger_name trigger_time trigger_event ON tbl_name FOR EACH ROW trigger_stmt

CREATE TABLE test1(a1 INT);
CREATE TABLE test2(a2 INT);
CREATE TABLE test3(a3 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE test4(
a4 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
b4 INT DEFAULT 0
);

delimiter |

CREATE TRIGGER testref BEFORE INSERT ON test1
FOR EACH ROW BEGIN
INSERT INTO test2 SET a2 = NEW.a1;
DELETE FROM test3 WHERE a3 = NEW.a1;
UPDATE test4 SET b4 = b4 + 1 WHERE a4 = NEW.a1;
END;
|

delimiter ;



         


Link to this page:
* Required Fields
 Add Comment:
Name* :
Email :
Comment* :
 
Contact Us About Us Privacy Policy Disclaimer
Copyright © 2008 - 2010 ExamplesOf .com