How to create MySQL trigger -


i have table users 2 fields id (numeric) , email (with full email adress) how add trigger can prevent adding new email records specific domains eg: *@somedomain.com?

the trigger this:

delimiter $$  create trigger user_insert before insert on user     each row begin   if new.email '%@somedomain.com'     signal sqlstate '99999'         set message_text = 'invalid domain';   end if; end$$   delimiter ; 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -