I have 2 tables – [stakeholders] and [organizations].
FK from [organizations.stakeholder_id] to [stakeholders.id].
I want to create [stakeholder] record automatically when new [organization] is created AND to assign newly created [stakeholder.id] back to [organizations.stakeholder_id] in the same transaction.
Is it possible and how?
Best Answer
No it's not possible to create a child record without creating the parent record, but you can always(even in programming languages) insert into the parent table first and then insert into the child table.
For example in any programming language if you have the id number that you want to add to your database you can use it in both insert statements.