errno : 150 (create table statement)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gomzi
    Contributor
    • Mar 2007
    • 304

    errno : 150 (create table statement)

    I am getting an error no 150 when i try to create relationships between three tables.
    Here are the statements : -

    TABLE A
    create table a(id1 int(7),id2 int(7),primary key (id1));

    TABLE B
    create table b(id1 int(7),id2 int(7),primary key(id2));

    TABLE C
    create table c(id1 int(7),id2 int(7),foreign key(id1) references a(id1) on delete cascade,foreign key(id2) references b(id2));

    any idea as to where m going wrong?
  • masdi2t
    New Member
    • Jul 2006
    • 37

    #2
    Originally posted by gomzi
    I am getting an error no 150 when i try to create relationships between three tables.
    Here are the statements : -

    TABLE A
    create table a(id1 int(7),id2 int(7),primary key (id1));

    TABLE B
    create table b(id1 int(7),id2 int(7),primary key(id2));

    TABLE C
    create table c(id1 int(7),id2 int(7),foreign key(id1) references a(id1) on delete cascade,foreign key(id2) references b(id2));

    any idea as to where m going wrong?

    base on my own experience, thus error told us tha we have error in foreign key area. maybe u specify on delete set null on not null column or something like that. just check ur foreign key design.

    or for ur testing, u can create table c without any foreign key

    cmiiw

    Comment

    Working...