MySQL Forums
Forum List  »  InnoDB

foreign key problem
Posted by: shwetha v
Date: May 21, 2011 11:36PM

Hi,
Am not able to create a child table with foreign key.

create table abc(sid varchar(10) not null, pid varchar(10) not null, name varchar(20), diagnosis varchar(15), date date, time time, primary key(sid, pid))type=innodb;

create table xyz(caseno varchar(10) not null, pid varchar(10) not null, pname varchar(20), age int, gender varchar(5), dob date, primary key(caseno, pid), foreign key(pid) references abc(pid) on delete cascade on update cascade)type=innodb;

I am not able to create table xyz with the foreign key. It is giving error like cant create table (errno:150).

Can anyone please help me out...... please..........

Thank you.

Options: ReplyQuote


Subject
Views
Written By
Posted
foreign key problem
1377
May 21, 2011 11:36PM
759
June 06, 2011 08:24AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.