I have two tables with a one to many relationship: boys and their toys. I want to know if there are any advantages or disadvantages for each of the following two ways to create the tables. I am mainly interested in performance. Either way the insert and select queries aren't any more difficult than the other way.

CREATE TABLE boy (
BoyID INT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (BoyID)
);

CREATE TABLE toy (
BoyID INT NOT NULL,
ToyID INT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (BoyID,ToyID)
);


OR



#no change here CREATE TABLE boy ( BoyID INT NOT NULL AUTO_INCREMENT, name CHAR(30) NOT NULL, PRIMARY KEY (BoyID) );

#slight change here
CREATE TABLE toy (
ToyID INT NOT NULL AUTO_INCREMENT,
BoyID INT NOT NULL,
name CHAR(30) NOT NULL,
PRIMARY KEY (ToyID)
);


Chris W




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to