When creating this code always comes the error:
1215 "Can not add foreign key constraint"
I have tried everything, checked the foreign key constraints and nothing. Can someone help me?
create table alunodisc (
codigodisc int,
mataluno int ,
constraint PK primary key(codigodisc,mataluno),
constraint codalundisc foreign key (codigodisc) references disciplinas(codisc),
constraint matalundisc foreign key (mataluno) references alunos(mataluno)
);