I have to do a trigger, where to be excluded an employee will also be excluded its dependent. But I can not exclude. the code looks like this:
delimiter $
create trigger TRG_excluiDependente_AD
after delete
on Funcionario
for each row
begin
-- alter table Dependente drop foreign key ID_Func;
delete from Dependente where Dependente.ID_Func = old.ID_Func;
end$
delimiter ;
drop trigger TRG_excluiDependente_AD;
alter table Dependente DROP foreign key fk_dep_func ;
delete from Funcionario where ID_Func = 4;
And I get the title error, and I've removed the FK-> Dependent