research Question

mysql trigger

Avatar of marrowyung
marrowyung asked on
Databases* SQL scriptMySQL Server
1 Comment1 Solution9 ViewsLast Modified:

That company wants to enforce the following logic when it comes to inserting new rows to the accounts table:
1)name must have at least 3 characters.
2) email must contain at least one @characters.

we try to build a trigger for it so that it signal '45000' as a SQLSTATE error without setting MESSAGE_TEXT, if either of those vaildation fail.

what should be the script of the trigger?

Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros