I have this piece of code to alter a tables relationship but I want to add cascade update and delete operations do I need to add cascade update cascade delete to this code
ALTER TABLE product_images
ADD FOREIGNKEY (product_id) REFERENCES products(product_id)
this is a one to many relationship I hope my code is right for a start. I have a products table and a product_images table which has many images for each product
Updated
ALTER TABLE product_images
ADD FOREIGN KEY (product_id) REFERENCES products(product_id)
Those referential actions need to be specified. RESTRICT is default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With