Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Posts
    2

    Thumbs up Unanswered: Cannot Buid Table errno 150

    I try to Create Table it's show "errno 150" I use phpMyadmin to create table by use this command:

    CREATE TABLE USER_TEAM(
    userID BIGINT UNSIGNED NOT NULL ,
    TeamID BIGINT UNSIGNED NOT NULL ,
    PRIMARY KEY ( userID, TeamID ) ,
    INDEX userteamID_idx( userID ) ,
    INDEX teamteamid_idx( Teamid ) ,
    FOREIGN KEY ( userID ) REFERENCES USER2( userID ) ,
    FOREIGN KEY ( TeamID ) REFERENCES TEAM( TeamID )
    ) TYPE = InnoDB;

    CREATE TABLE team (
    TeamID int(4) unsigned NOT NULL default '0',
    TeamName varchar(200) NOT NULL default '',
    PRIMARY KEY (TeamID),
    KEY TeamID_idx (TeamID)
    ) TYPE=InnoDB;

    CREATE TABLE user2 (
    userID int(4) unsigned NOT NULL auto_increment,
    lastName varchar(200) NOT NULL default '',
    firstName varchar(200) NOT NULL default '',
    office varchar(200) NOT NULL default '',
    home varchar(200) NOT NULL default '',
    tel varchar(200) NOT NULL default '',
    mob varchar(200) NOT NULL default '',
    email varchar(200) NOT NULL default '',
    fax varchar(200) NOT NULL default '',
    PRIMARY KEY (userID),
    KEY userid_idx (userID)
    ) TYPE=InnoDB;

    Please Help me!

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: Cannot Buid Table errno 150

    Originally posted by suparuksa
    I try to Create Table it's show "errno 150" I use phpMyadmin to create table by use this command:

    CREATE TABLE USER_TEAM(
    userID BIGINT UNSIGNED NOT NULL ,
    TeamID BIGINT UNSIGNED NOT NULL ,
    PRIMARY KEY ( userID, TeamID ) ,
    INDEX userteamID_idx( userID ) ,
    INDEX teamteamid_idx( Teamid ) ,
    FOREIGN KEY ( userID ) REFERENCES USER2( userID ) ,
    FOREIGN KEY ( TeamID ) REFERENCES TEAM( TeamID )
    ) TYPE = InnoDB;

    CREATE TABLE team (
    TeamID int(4) unsigned NOT NULL default '0',
    TeamName varchar(200) NOT NULL default '',
    PRIMARY KEY (TeamID),
    KEY TeamID_idx (TeamID)
    ) TYPE=InnoDB;

    CREATE TABLE user2 (
    userID int(4) unsigned NOT NULL auto_increment,
    lastName varchar(200) NOT NULL default '',
    firstName varchar(200) NOT NULL default '',
    office varchar(200) NOT NULL default '',
    home varchar(200) NOT NULL default '',
    tel varchar(200) NOT NULL default '',
    mob varchar(200) NOT NULL default '',
    email varchar(200) NOT NULL default '',
    fax varchar(200) NOT NULL default '',
    PRIMARY KEY (userID),
    KEY userid_idx (userID)
    ) TYPE=InnoDB;

    Please Help me!
    Your problem is in foreign key.

    Try to create table "user_team" after "team" and "user2" because if they does'nt exist then you can't refference to them.

  3. #3
    Join Date
    Mar 2004
    Posts
    480
    Curious why all your fields are of length (200)?
    Surely you won't need that many characters in all instances.

    You will have very large amounts of disk space allocated to your tables without them ever being filled up. This also might affect performance, but I'm not 100% sure about that.

  4. #4
    Join Date
    Apr 2004
    Posts
    2

    Thumbs up

    I create this table by order : user,team and then user_team but it also show "error150"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •