标签: mysql sql triggers
是否可以在同一个表上插入事件后删除表的某些行?
CREATE TRIGGER before_insert_purge BEFORE INSERT ON MYTABLE BEGIN DECLARE num INTEGER; SELECT COUNT * INTO num FROM MYTABLE; IF num>3 THEN DELETE * FROM MYTABLE; END IF; END