Reputation: 1315
After setting a foreign key relation we can select the action to perform when the row is deleted/updated in master table (foreign key origin).
My question is:
Can I set a relation so when a record is inserted in a master table all related tables insert a new row with the foreign key? I'm looking for this solution because it would be really safer to create records with dependancies. I'm already creating this tree of dependant records manually using PHP.
Thanks in advance.
Upvotes: 0
Views: 30
Reputation: 1317
You are basically describing a trigger, so please read https://dev.mysql.com/doc/refman/5.7/en/trigger-syntax.html
Hope that helps.
Upvotes: 1