i am creating my own little blog and i am trying to create a comments table
that uses the primary key of my blog table as a foreign key. i've tried the
only two ways that i know how and both ways yielded the same error:

#1005 - Can't create table '.\mydatabase\comments.frm' (errno: 150)

i orginally created the comments table before i read about FOREIGN KEYS, so
i tried executing the following command:

ALTER TABLE comments 
ADD FOREIGN KEY(comment_journal_id) 
REFERENCES journal(journal_id)
ON DELETE CASCADE ON UPDATE CASCADE;

which resulted with the same error as listed above. so not really knowing 
what i was doing, i decided to try and create the comments table from
scratch using the following the command thinking that it might work (which 
it didn't):

CREATE TABLE comments(
comment_id INT,
journal_id INT,
INDEX jrn_ind( journal_id ) ,
FOREIGN KEY ( journal_id ) REFERENCES journal( journal_id )
ON DELETE CASCADE ON UPDATE CASCADE
) TYPE = INNODB

now before i go and do something stupid, i thought i might ask for some help
on this issue :D both my blog and comments tables are InnoDB.


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

Reply via email to