Skip to content

Instantly share code, notes, and snippets.

@maulvi maulvi/trigger
Created Sep 18, 2017

Embed
What would you like to do?
trigger
BEGIN
DECLARE
email_count INT;
SELECT COUNT(*)
INTO email_count
FROM employees
WHERE LCASE()
IF email_count > 0
THEN
SET NEW.email = CONCAT_WS(NEW.lastName, LEFT(NEW.firstName, 1), email_count, '@classicmodelcars.com');
ELSE
SET NEW.email = CONCAT_WS(NEW.lastName, LEFT(NEW.firstName, 1), '@classicmodelcars.com');
END IF;
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.