MySQL Forums
Forum List  »  Newbie

Re: Can't create tables?
Posted by: Roland Bouman
Date: August 21, 2005 04:47PM

Hi,

try explicitly defining the columns in the referenced table too:

FOREIGN KEY orders2customers (
customer_numb
) REFERENCES customers (
customer_numb
)
ON DELETE RESTRICT

(Make sure the referenced table exists, and has a primary key or unique constraint defined for the columns that you'll be referencing)

Looking at the CREATE TABLE syntax in the manual, your syntax (implicit referenced columns) seems valid. See:

http://dev.mysql.com/doc/mysql/en/create-table.html

On the other hand, compare it the syntax (explicit referenced columns) illustrated here:

http://dev.mysql.com/doc/mysql/en/innodb-foreign-key-constraints.html

I'd say there's some incompatibility here.

Options: ReplyQuote


Subject
Written By
Posted
August 21, 2005 02:25PM
Re: Can't create tables?
August 21, 2005 04:47PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.