Mysql自动插入新表

Can anyone explain me what below code actually do, I have this on my mysqlDB.sql exported file

DROP TRIGGER IF EXISTS `alertupdateevent`;
DELIMITER $$
CREATE TRIGGER `alertupdateevent` AFTER INSERT ON `RECOG`
 FOR EACH ROW BEGIN
INSERT INTO `mydb`.`ALERTUPDATES` (`FIRSTNAME`, `LASTNAME`, `CAMNAME`, `TIMESTAMP`, `RESERVE1`, `ALERTTYPE`, `IMGURL`) VALUES (NEW.FIRSTNAME, NEW.LASTNAME, NEW.DOB, NEW.TIMESTAMP, NEW.FACEID, 'RECOG' , NEW.FACEURL);
END
$$
DELIMITER ;

Currently I dealing a project which is not developed by me, and I am not well familiarized with mysql.

The problem I am facing is I have two table in DB like RECOG and ALERTUPDATES and I need to insert data to both of these table(same data), and I can see only one php which insert data to the table `RECOG'.

So my question does the above piece of code insert data automatically to table ALERTUPDATES when data insert on RECOG table by php.

Try this..

CREATE TRIGGER trigger_name
BEFORE INSERT
   ON table_name FOR EACH ROW

BEGIN

   -- variable declarations

   -- trigger code

END;

Parameters or Arguments

trigger_name

The name of the trigger to create.

BEFORE INSERT

It indicates that the trigger will fire before the INSERT operation is executed.

table_name

The name of the table that the trigger is created on.

RESTRICTIONS

You can not create a BEFORE trigger on a view.
You can update the NEW values.
You can not update the OLD values.

Example:

DELIMITER //

CREATE TRIGGER contacts_before_insert
BEFORE INSERT
   ON contacts FOR EACH ROW

BEGIN

   DECLARE vUser varchar(50);

   -- Find username of person performing INSERT into table
   SELECT USER() INTO vUser;

   -- Update create_date field to current system date
   SET NEW.created_date = SYSDATE();

   -- Update created_by field to the username of the person performing the INSERT
   SET NEW.created_by = vUser;

END; //

DELIMITER ;

Ref:http://www.techonthenet.com/mysql/triggers/before_insert.php

Yes, you are correct. Trigger are used to INSERT UPDATE on some TABLE based on action perform on some TABLE actions like insert, update or delete. Refer MySQL triggers