colinkites2000
08-10-2009, 10:53 PM
Hello,
I'm trying to setup foreign keys but PHPmyadmin won't give me the option to select innodb. I checked this tutorial http://www.mytechmusings.com/2008/04/using-foreign-keys-in-mysql.html which is quite good, but the option to select innobd is not there for me. Does this mean my server might not support innodb?
Perhaps I can do this with myisam?
I've have a product table listing products, with an auto-incrementing primary key.
I also have a location table listing where on the website that product will go. IE "index4" would put the product in the 4th table in the index. In this table, I have 3 columns - An auto-incrementing primary key, the product ID and the location. Originally, I had the product ID as the primary key and somehow setup a working relationship but then I was running into problems since the product ID's had duplicates - they were duplicated in order to list the different locations. So then I realized that the primary key should be unique and added an auto-incrementing id column. However, now I cannot get these tables to relate.
1. Do I need to switch to innodb for this application? I don't need referential integrity at this point, maybe it's a good idea though.
2. How can I make these two tables relate through phpmyadmin so that my JOIN will work again?
SELECT products.Range_RPM
FROM products INNER JOIN locations ON locations.Product_Id = products.Product_Id
WHERE locations.Location = 'index4'
Best,
C
I'm trying to setup foreign keys but PHPmyadmin won't give me the option to select innodb. I checked this tutorial http://www.mytechmusings.com/2008/04/using-foreign-keys-in-mysql.html which is quite good, but the option to select innobd is not there for me. Does this mean my server might not support innodb?
Perhaps I can do this with myisam?
I've have a product table listing products, with an auto-incrementing primary key.
I also have a location table listing where on the website that product will go. IE "index4" would put the product in the 4th table in the index. In this table, I have 3 columns - An auto-incrementing primary key, the product ID and the location. Originally, I had the product ID as the primary key and somehow setup a working relationship but then I was running into problems since the product ID's had duplicates - they were duplicated in order to list the different locations. So then I realized that the primary key should be unique and added an auto-incrementing id column. However, now I cannot get these tables to relate.
1. Do I need to switch to innodb for this application? I don't need referential integrity at this point, maybe it's a good idea though.
2. How can I make these two tables relate through phpmyadmin so that my JOIN will work again?
SELECT products.Range_RPM
FROM products INNER JOIN locations ON locations.Product_Id = products.Product_Id
WHERE locations.Location = 'index4'
Best,
C