Thread: Storing prices
View Single Post
Old 11-08-2012, 09:15 PM   PM User | #18
LearningCoder
Regular Coder

 
LearningCoder's Avatar
 
Join Date: Jan 2011
Location: The Pleiades
Posts: 849
Thanks: 67
Thanked 28 Times in 28 Posts
LearningCoder is an unknown quantity at this point
Ah thank you, I am currently viewing this page: http://dev.mysql.com/doc/refman/5.5/...nstraints.html and found what you typed there.

When you say giving the CONSTRAINT a name, is [symbol] where you put your name?

Using mysql version 5.5 and it's telling me I have a syntax error near 'REFERENCES products(productID) ) ENGINE=INNODB' at line 1'...Not sure why as I already have my products table setup and ready, and the syntax looks to be right according to that website.

Here is what I am typing in:
Code:
CREATE TABLE product_images ( imgID INT AUTO_INCREMENT PRIMARY KEY, productID INT, imgName VARCHAR(50), CONSTRAINT FOREIGN KEY (productID) REFERENCES products(productID) ON CASCADE DELETE) ENGINE=INNODB;
Can you spot any issues?

Kind regards,

LC.
LearningCoder is offline   Reply With Quote