Tengo dos Foreigns Keys y no logro que se inserten, me da error. Alguna idea:
mysql> create table Inscritos(
-> id int(6) not null auto_increment,
-> estudianteId int(6) unsigned not null,
-> tutorialId int(6) unsigned not null,
-> primary key(id),
-> index (estudianteId),
-> index (tutorialId),
-> foreign key(estudianteId) references Student(id),
-> foreign key(tutorialId) references Tutorials(id)
-> );
ERROR 1215 (HY000): Cannot add foreign key constraint
La creación de la tabla Student es la siguiente:
mysql> create table Student(
-> id int(6) unsigned auto_increment primary key,
-> firstname varchar(30) not null,
-> lastname varchar(30) not null
-> );
Y la creación de la tabla Tutorials es:
mysql> create table Tutorials(
-> id int(6) auto_increment primary key,
-> title varchar(100) not null,
-> author varchar(40) not null,
-> date DATE
-> );