What are advantages of using a one-to-one table relationship? (MySQL) What are advantages of using a one-to-one table relationship? (MySQL) database database

What are advantages of using a one-to-one table relationship? (MySQL)


One possible use is when part of the information is optional. This way you don't need to have a bunch of nullable fields in one big table, but can separate it logically into the mandatory table and an optional table.

Other use is when some of the data is shared with different tables. For instance let's say you have a site where you sell computer parts. You could put the details that all components share into eg. "parts" table, but put the specifics in "motherboards", "cpus", etc. which would just use parts table with one-to-one relation.


I've used one to one relationship for extending some features in existing applications, without affecting the application db structure. This is an unobtrusive way to extending existing db tables.

Another reason to use one-to-one relationship is for implementing Class Table Inheritance, in which each class in the hierarchy has a table, and an object has a corresponding row in his table class, in his parent class table, in his grandparent class table and so on.

See, for example, Doctrine 2 Class Table Inheritance Page


Here's two, I'm sure others will post more

  • you want to extend an existing table without actually modifying the table. Perhaps it was supplied by a third party vendor and you want to keep your extensions separated by simply having a second table that shares the same key.
  • maybe there are fixed width columns in the table which are accessed frequently, and variable ones which aren't. In this case, there might be efficiency gains to be had from having a table with a fixed row length for the frequent stuff, with a secondary table for everything else.

Also, when normalizing a database, say to 3rd Normal Form (3NF) you might find you've got columns which aren't really "about" the key and need to be pulled out to a separate table.