I'm creating a modeling but I'm stumbling on an error when I create foreign keys. MYSQL gives a "Can not add foreign key constraint" error. follow my sql.
use fatec;
create table aluno(
ra int not null primary key,
nome varchar(255),
cidade varchar(255),
endereco varchar(255)
);
create table diciplinas(
id int not null primary key auto_increment,
nome varchar(255),
carga_hor int
);
create table professores (
id int not null primary key auto_increment,
nome varchar(255),
cidade varchar(255),
endereco varchar(255)
);
create table turmas(
id int not null,
id_diciplina int not null,
id_prof int not null,
ano int,
horario varchar(5),
primary key(id)
CONSTRAINT FK_diciplinas foreign key(id_diciplina) references diciplinas(id),
CONSTRAINT FK_professor foreign key(id_prof) references professor (id)
);