Hello my friends the IT knowledge lovers… You are on my blog
at “We Are Knowledge”.. in here you want to getting and take many IT
knowledge, you can get it FREE. You are was choice the right blog, because this
is blog to fill many IT knowledge..
Likely this article, discuss about program language “MySQL”,
and my tutorial is “TRIGGER IN MYSQL”.. you will know ?? let’s do read this
article, have fun and enjoy friends to read…
1. Trigger
Previously you known trigger in Mysql ?. Trigger in mysql query in MySQL used for calling one command or
more than one command in SQL automatically after process update, insert, or
delete from the table.
This is usefulness of the trigger :
- The trigger we can update the data automatically if we want to change the contents of the table.
- And the second trigger function can also be used to implement a system log, and it will automatically save to the table
- We can also use the trigger if you want the validation and verification of data before the data is stored in tables.
2. Making New Trigger
You can follow this command, if you will making the new
trigger :
Example 1 :
CREATE TRIGGER trigger_name
[BEFORE | AFTER] [UPDATE | DELETE | INSERT]
ON your_table_name
FOR EACH ROW
statement
Explanation :
Before
>> We can determine
when the process will be executed (run) "before" process
After
>> We can determine
when the process will be executed (run) "after" process
Insert
>> Is to determine the
event "insert" on the trigger that will run on command - a command
trigger
Update
>> Is to determine the
event "Update" on the trigger that will run on command - a command trigger
Delete
>> Is to determine the
event "delete" on the trigger that will run on command - a command
trigger
3. Deleting Trigger
Because we can create a trigger, we also prepare Mysql
command to remove the trigger, and this syntax to remove the trigger
DROP TRIGGER trigger_name. your_table_name;
Ok… just it…
I hope you
understand..
Thank you for visiting…
See you later friends
No comments:
Post a Comment