I have a very simple question, so I hope someone will help.
I have a MySQL table with ID and CREDIT. I want to do an update trigger, which would change the update value if credit is 0. So something like “if old.CREDIT = 0 then new.CREDIT = 0.001”. So what will be the syntax of the trigger? Thanks.
Please read tutorial on MySQL Triggers which gives simple to complex examples.
Here is a simple example on
before updatetrigger, that may help you.Assuming table name as
credit_info.Let us say, table have 2 records as follows:
When you issue an update statement as:
The resulting record would be as follows:
Let me hope, sample example will accelerate your energies.