Create TRIGGER after INSERT
Creates trigger that runs
after
insert
and logs into
log
table
DROP TRIGGER IF EXISTS after_student_insert;

DELIMITER $$

    CREATE TRIGGER after_student_insert BEFORE INSERT 
    ON students
    FOR EACH ROW 
    BEGIN

    INSERT INTO log (description)
    VALUES ('One student inserted');

    END$$

DELIMITER ;
by Valeri Tandilashvili
4 years ago
0
Pro tip: use ```triple backticks around text``` to write in code fences