What is a foreign key with cascade delete in sql server? a foreign key with cascade delete means that if a record in the parent table is deleted, then the corresponding records in the child table will automatically be deleted.. Alter table `categories_products` add constraint `constr_categoriesproducts_categories_fk` foreign key `categories_fk` (`categories_id`) references `categories` (`id`) on delete cascade on update cascade, constraint `constr_categoriesproducts_products_fk` foreign key `products_fk` (`products_id`) references `products` (`id`) on delete cascade. You object to on update cascade for foreign keys on the principle that primary keys should not be updated. just because one possible use of a foreign key is to reference a primary key does not mean that it is the only possible use of a foreign key. you do not address the fact that in oracle, foreign keys can also reference unique constraints..
How to add “on delete cascade” constraints? ask question. up vote 134 down vote favorite. 22. in postgresql 8 is it possible to add on delete cascades to the both foreign keys in the following table without dropping the latter? foreign key violation on delete and update. 0.. Create table orders ( o_id integer not null primary key, p_id integer not null unique constraint fk_persons_orders foreign key references persons (p_id) on update cascade on delete cascade, orderno integer not null );. It's the other way round. you have a foreign key on column modelid in the devices table, and probably a primary key on column id in models. if a model is deleted, all rows in devices that reference that particular modelid will be deleted as well..