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 > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "what are the defects of mysql flip-flop". In daily operation, I believe many people have doubts about the defects of mysql flip-flop. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "what are the defects of mysql flip-flop?" Next, please follow the editor to study!
Description
1. Business logic implemented with triggers is difficult to locate when problems occur.
Especially when multiple triggers are involved, it will make later maintenance difficult.
2. Extensive use of triggers can easily lead to confusion of code structure.
Increase the complexity of the program.
3. If the amount of data that needs to be changed is large, the execution efficiency of the trigger will be very low.
4. The implicit call of trigger is easy to be ignored.
It's hard to troubleshoot.
Example
# create table creation trigger mysql > CREATE TABLE account (acct_num INT, amount DECIMAL (10Magazine 2)); Query OK, 0 rows affected (0.03 sec) mysql > INSERT INTO account VALUES (137Mae 14.98), (141Met 1937.50), (97Lay 100.00); mysql > delimiter / / mysql > CREATE TRIGGER upd_check BEFORE UPDATE ON account FOR EACH ROW BEGIN IF NEW.amount
< 0 THEN SET NEW.amount = 0; ELSEIF NEW.amount >100 THEN SET NEW.amount = 100; END IF; END;//mysql > delimiter; # verify that the trigger works mysql > select * from account +-+-+ | acct_num | amount | +-+-+ | 1937.50 | 1937.50 | 97 |-100.00 | +-+-+ 3 rows in set (0.00 sec) mysql > update account set amount = 114.98 where acct_num = 137 Query OK, 1 row affected (0.01sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql > select * from account +-+-+ | acct_num | amount | +-+-+ | 100.00 | 100.00 | 1937.50 | 97 |-100.00 | +-+-+ 3 rows in set (sec) # View trigger mysql > show triggers # delete trigger mysql > drop trigger if exists upd_check; # View all triggers in the database instance SELECTa.TRIGGER_SCHEMA,a.TRIGGER_NAME,a.ACTION_TIMING,a.EVENT_OBJECT_TABLE,a.EVENT_MANIPULATIONFROMinformation_ schema.`TRIGGERS` aWHEREa.TRIGGER_SCHEMA NOT IN ('information_schema',' performance_schema', 'mysql',' sys'); delimiter / / set the MySQL execution end flag. Default is At this point, the study of "what are the defects of mysql triggers" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.