Column and trigger structures in user tables
CREATE TABLE `users` ( `created_in` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
trigger | event | sheet | statement | time |
---|---|---|---|---|
... | insert | user | IF NEW.created_in = "" THEN SIGNAL SQLSTATE "45000"; IF END |
Before |
I'm trying to cancel the insert if the created_in column isn't there but that doesn't work.
How to check whether the created_in column is none?
MySQL version is 5.7
P粉0217082752024-04-04 16:19:39
No trigger is required, session strict mode is enough:
db<>violinhere p>