|
Posted by NC on 02/24/06 08:51
Jim Michaels wrote:
>
> When you create a table, the relationship is created
> as follows with the keyword REFERENCES:
> CREATE TABLE `dbo`.`categoryroots` (
> `cat_id` int(10) unsigned NOT NULL default '0'
> COMMENT 'copy of cat_id from categories table',
> PRIMARY KEY (`cat_id`),
> FOREIGN KEY (`cat_id`) REFERENCES `categories`(`cat_id`)
> ON DELETE CASCADE ON UPDATE NO ACTION,
> UNIQUE KEY `ix_crcat_id` (`cat_id`)
> ) ENGINE=InnoDB;
This only works on InnoDB tables; moreover, the ON UPDATE action on
foreign keys is only available in MySQL 4.0.8 or newer...
Cheers,
NC
[Back to original message]
|