How to create triggers in DB using XAMPP?

0

A group has N events and each event has M expenses.

1) The trigger below should update the last modification made to the group when an INSERT is done in the event table. Why does not it work?

CREATE TRIGGER trg_eventos AFTER INSERT ON eventos
FOR EACH ROW
BEGIN
    UPDATE grupos SET ultima_att = CURRENT_TIMESTAMP WHERE grupo_id = (
        SELECT grupo_id_ref FROM evento_pertence_grupo WHERE evento_id_ref = NEW.evento_id
    );
END

2) Can you create a trigger for an INSERT, UPDATE and DELETE at once? For example:

CREATE TRIGGER faz_tudo AFTER INSERT, UPDATE, DELETE ON tabela
    
asked by anonymous 25.04.2018 / 22:02

0 answers