In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following brings you about mysql trigger writing template, if you are interested, let's take a look at this article, I believe that reading mysql trigger writing template will be of some help to you.
The trigger of mysql is that a table triggers the corresponding trigger for the insert,delete,update operation and performs the corresponding operation, such as the corresponding delete operation, which can back up the deleted data. For updates, you can save the updated data and the old data, which can be compared later or serve as a cache for the fallback operation. The following is the template written by the trigger:
Create create TRIGGER triggerName
[AFTER | BEFORE] [DELETE | INSERT | UPDATE] ON tableName
FOR EACH ROW
Begin
Statement
End
Where:
AFTER indicates that the trigger is triggered after the operation is completed.
BEFORE indicates that the trigger is triggered before the operation
DELETE means the trigger for deletion, that is, if the data of the table is deleted, the trigger is triggered. Using OLD, you can retrieve the data of all fields in the deleted record, OLD.fieldName, which is the data of the fieldName field.
INSERT represents the trigger of the insert event, that is, the trigger is triggered when the table inserts data, in which NEW can be used to insert the data of all fields of the data, and NEW.fieldName means to take out the data of the fieldName field.
UPDATE represents the trigger for updating data, that is, when the data of the table is updated, the trigger is triggered, in which OLD is used to fetch the old data and NEW to fetch the new data.
A trigger cannot have a return value, that is, it cannot have a statement of select * from tablename;, it can have a select fieldName into vname from tablename where. The sentence of.
Read the above on the mysql trigger writing template details, whether there is anything to gain. If you want to know more about it, you can continue to follow our industry information section.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.