First of all, I would like to say that I have checked several questions about this here and no solution worked.
I'm giving alter table in the official table to add two foreign keys ... one of them works (num_department) but the other one for some reason returns error 1215.
Follow the queries:
alter table departamento
add num_sup int,
add num_departamento int,
add primary key(num_departamento,num_sup)
alter table funcionario
add num_sup int,
add num_departamento int,
add constraint fk_num_depart foreign key(num_departamento) references
departamento(num_departamento),
add constraint fk_num_supr foreign key(num_sup) references
departamento(num_sup)
I have tried to drop the table and check the fields, among other solutions, but nothing worked ... What can be?
The modeling of the tables follows.