0

I am working on a MySQL database that has to treat organizations and people as interchangeable in some instances and not others. Because of this, I created a table called LegalEntity as a superclass. It has an optional 1 to 1 relationship with two other tables: Person and Organization. How I can make the database automatically insert a row into LegalEntity whenever I insert a new row into Person or Organization?

3
  • Use BEFORE INSERT triggers...
    – Akina
    May 26, 2023 at 5:13
  • <opinion>That schema will cause you trouble</opinion>
    – Rick James
    May 26, 2023 at 5:40
  • Do you have referential integrity constraints for your super table (other than for the sub-tables)? If not you may be better of with a union view as "super" table May 26, 2023 at 7:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.