create table with foreign key

2005-04-29 Thread Scott Purcell
Hello, I have this simple table of unique items. CREATE TABLE ITEM ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, manufacturer_id varchar(50), ) TYPE=InnoDB; Foreach item, I can have 1 to many assets. So I am trying to use this: CREATE TABLE ITEM_ASSET_REL ( id INT,

Re: create table with foreign key

2005-04-29 Thread SGreen
Re-read the section on foreign keys (http://dev.mysql.com/doc/mysql/en/innodb-foreign-key-constraints.html). It clearly says (in the second and third bullets) that you must index the columns on both ends of a FK. Add an index to ITEM_ASSET_REL that contains id as its first term then you will

Re: create table with foreign key

2005-04-29 Thread mfatene
Hi, I think it's because you added a comma after the second line in the create table item. So this table was not created. manufacturer_id varchar(50), must be manufacturer_id varchar(50)) When done, i had no problem to create my FK (4.1.11) Mathias Selon Scott Purcell [EMAIL PROTECTED]: