Alter table inventory add constraint fk_inv_product_id foreign key (product_id) references products (product_id) on delete cascade; in this foreign key example, we've created a foreign key on the inventory table called fk_inv_product_id that references the products table based on the product_id field.. Alter table table_name drop foreign key `fk_name`, add constraint `fk_name2` foreign key (`remote_id`) references `other_table` (`id`) on delete cascade; this is useful to minimize downtime if you have a large table.. Now adding the foreign key to id as: alter table two add constraint `0_38775` foreign key (id) references one(id) on delete cascade on update cascade the table two comes as with the values from table one: id salary name now to maintain referential integrity, how to update the values of table two when table one is updated..
Alter table profiles add constraint `fk_test` foreign key (`member_id` ) references `members` (`member_id` ) on delete cascade if you will need to update that constraint - you'll have to remove it at then create again, there's no direct way to alter it.. Alter table table_name add constraint constraint_name foreign key (column1, column2, column_n) references parent_table (column1, column2, column_n) on delete cascade; example let's look at an example of how to create a foreign key with cascade delete using the alter table statement in oracle/plsql.. Alter table dbo.devices add constraint devices_modelid_fk foreign key (modelid) in my case i will never change the id of devices so having update cascade or no action will be the same. references dbo.categories(id) on delete no action on update no action; alter table dbo.profiles add constraint profiles_id_fk foreign key (id) references.