Chris,
Thursday, May 30, 2002, 1:58:54 AM, you wrote:
>> CREATE TABLE parent(id INT NOT NULL,
>> PRIMARY KEY (id)) TYPE=INNODB;
>>
>> CREATE TABLE child(id INT, parent_id INT,
>> INDEX par_ind (parent_id),
>> FOREIGN KEY (parent_id) REFERENCES parent(id)
>>
> OI!!! I'm going to sound like a complete ass now (I know) But since
> when does MySQL support FOREIGN keys?? *gasp* MAN this is going to
> make my life S much easier *curses at phpMyAdmin for not having the
> option*
Do remember that this is only valid for mysql 3.23.50+
> CREATE TABLE parent(id INT NOT NULL,
> PRIMARY KEY (id)) TYPE=INNODB;
>
> CREATE TABLE child(id INT, parent_id INT,
> INDEX par_ind (parent_id),
> FOREIGN KEY (parent_id) REFERENCES parent(id)
> ON DELETE CASCADE) TYPE=INNODB;
OI!!! I'm goin
Hi,
I am evaluating InnoDB's Foreign Keys and am stuck.
Using the sample tables I want to add records in the Child table with a NULL
parent_id (this being referenced to the Parent table) as follows:
CREATE TABLE parent(id INT NOT NULL,
PRIMARY KEY (id)) TYPE=INNODB;
CREATE TABL