Hello,

I've tried to create these 4 test tables, but when I try to create the last 
one, MySQL gives the following error:

ERROR 1005 (HY000) at line 20: Can't create table '.\z\favorite_link.frm' 
(errno
: 150)

It seems that the foreign keys are not created well in the fourth table, and 
I don't know why.
Does anyone have any idea?

Here are the SQL statements for creating these tables:

create table if not exists user(
id int unsigned not null auto_increment primary key
) engine=InnoDB;

create table if not exists favorite(
id bigint unsigned not null auto_increment primary key,
user int unsigned not null,
foreign key(user) references user(id) on update cascade on delete cascade
) engine=InnoDB;

create table if not exists link(
id bigint unsigned not null auto_increment primary key,
user int unsigned not null,
foreign key(user) references user(id) on update cascade on delete cascade
) engine=InnoDB;

create table if not exists favorite_link(
favorite bigint unsigned not null,
link int unsigned not null,
primary key pri(favorite, link),
foreign key(favorite) references favorite(id) on update cascade on delete 
cascade,
foreign key(link) references link(id) on update cascade on delete cascade
) engine=InnoDB;

Thank you very much.

-- 
Octavian




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to