I have two Foreigns Keys and I can not get them inserted, I get an error. Any ideas:
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): Can not add foreign key constraint
The creation of the Student table is the following:
mysql> create table Student(
-> id int(6) unsigned auto_increment primary key,
-> firstname varchar(30) not null,
-> lastname varchar(30) not null
-> );
And the creation of the Tutorials table is:
mysql> create table Tutorials(
-> id int(6) auto_increment primary key,
-> title varchar(100) not null,
-> author varchar(40) not null,
-> date DATE
-> );