How would I end an if statement upon being satisfied but then execute the else if otherwise in a stored procedure?
I have tried putting an end if after the if statement:
IF EXISTS (SELECT * FROM `db`.`tbl` WHERE email = "email@domain.com") END IF;
ELSE INSERT INTO `db`.`tbl` (email) VALUES ("email@domain.com"); END IF;
But this didn’t work.
Why not use an ignore insert?
You would have to create a unique index on email.
Check here for some reference.