简体   繁体   中英

MySQL database one-to-one relation

If I have a database with multiple tables all with one to one relations. What is the best approach for when I register a row in one table, it's also registers a row across the related tables. I know you can use cascade to update and delete using foreign keys so is there a similar approach for creating these related rows with default values?

Creating null rows is not great design. Better create them only when necessary using foreign keys. If you still must, look at transactional stored procedures.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM