If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Cannot Buid Table errno 150

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-05-04, 23:54
suparuksa suparuksa is offline
Registered User
 
Join Date: Apr 2004
Posts: 2
Thumbs up 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!
Reply With Quote
  #2 (permalink)  
Old 04-06-04, 11:33
ika ika is offline
Registered User
 
Join Date: Oct 2003
Location: Slovakia
Posts: 482
Re: Cannot Buid Table errno 150

Quote:
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.
Reply With Quote
  #3 (permalink)  
Old 04-06-04, 13:58
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
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.
Reply With Quote
  #4 (permalink)  
Old 04-06-04, 22:09
suparuksa suparuksa is offline
Registered User
 
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"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On