Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use 1 to 1 tables in databases

Let me start this out by saying I'm anything but a database expert. I'm working on some code written by someone else and I've noticed a lot of 1-1 relationships between tables. Here's an example:

tblPropertyRecord
   pID
   hasPhotos
   hasVideo
   comment
   headline

tblPropertyLocation
   ID
   pID
   country
   region
   city
   zip
   street_address

tblPropertyOther
   ID
   pID
   upload_path
   isApproved
   isPaid

This doesn't encompass every field for a property - there are about 35 fields in total per record, but each table has, and can only have ONE entry for each record 1 to 1 to 1 ... I guess is the way to describe it?

Whats the benefit of this over just having tblPropertyRecord with 35 fields? I understand the point of many to 1, 1 to many, many to many ... but this just seems like added confusion with no real benefit.

like image 616
Will Avatar asked Nov 08 '10 17:11

Will


1 Answers

The tables might be 1-1 however the relationship might actually be 1 to 0..1 - they might be using the extra tables to avoid having a very sparsely populated table.

like image 150
SorcyCat Avatar answered Oct 23 '22 10:10

SorcyCat