In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces how to use functions and triggers in mysql to achieve non-primary key self-increment, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Function
Set global log_bin_trust_function_creators=1;DELIMITER / / DROP function if exists incNum//CREATE FUNCTION incNum () RETURNS int (11) BEGINset @ tem=1;select card_number into @ tem from `vip_ Card` order by card_number desc limit 1 position set @ tem=@tem+1;return @ tem;END//DELIMITER; select incNum ()
Trigger
CREATE TRIGGER incNum BEFORE INSERT ON vip_card FOR EACH ROW BEGIN set @ tem=1; select card_number into @ tem from `vip_ Card` order by card_number desc limit 1; set new.card_number=@tem+1; end has shared here about how to use functions and triggers to achieve non-primary key increment in mysql. I hope the above can be helpful and learn more. If you think the article is good, you can share it for more people to see.
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.