I created a trigger, at least, I’m trying to. But my query doesn’t quite work. What am I missing here?
The query inside the trigger works perfectly on it’s own:
INSERT INTO user_signup_log (user_id) VALUES (4)
This is my trigger query:
DELIMITER $$
CREATE TRIGGER user_signup_trigger BEFORE INSERT ON site_users
FOR EACH ROW BEGIN
INSERT INTO user_signup_log (user_id) VALUES (NEW.user_id)
END;
$$
DELIMITER ;
The error I’m getting:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END' at line 4
I followed instructions from another question here on stackoverflow how to create a trigger. And I also was able to create a different trigger with a similar query, and that one does work. You can find that one in another question, which is still unanswered
1 Answer