0
Create a trigger that automatically enrolls a student in "BD Laboratory I" as soon as it is registered in "Database I".
use Universidade;
insert into Realiza_matricula (RGAacad, Nomedisc) values(20179474911, 'Banco de Dados I');
Delimiter $$
create trigger matricula
after insert on Realiza_matricula
for each row
BEGIN
IF (select * From Realiza_matricula Where Nomedisc = 'Banco de Dados I') THEN
insert into Realiza_matricula values (NEW.RGAacad, 'Laboratorio de BD I', OLD.Date);
end if;
END $$
Delimiter;
It would not be more practical to just check if NEW.Nomedisc is 'Database I' and in this case insert the discipline 'BD Laboratory I', without the need to make the query?
– anonimo