Re: Reasons for creating linking tables?

From: Machiel Richards <machielr(at)rdc(dot)co(dot)za>
To: Oliveiros d'Azevedo Cristina <oliveiros(dot)cristina(at)marktest(dot)pt>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Reasons for creating linking tables?
Date: 2010-11-15 12:28:30
Message-ID: 1289824110.2729.77.camel@machielr-laptop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thank you,

that is exactly how I was looking at it too, however the specific
database have loads of these so I thought that maybe there is a reason
for it and I might be missing something due to limited experiences.

-----Original Message-----
From: Oliveiros d'Azevedo Cristina <oliveiros(dot)cristina(at)marktest(dot)pt>
To: Machiel Richards <machielr(at)rdc(dot)co(dot)za>, pgsql-novice(at)postgresql(dot)org
Subject: Re: [NOVICE] Reasons for creating linking tables?
Date: Mon, 15 Nov 2010 12:26:19 -0000



I would like to get the point of view from you guys out there who
has had a lot of database experience.

While busy looking into a database that have a lot of issues I have
found the following scenario :

- Let's call the 3 tables in question tables a,b & c.
- Currently table a has got a FK referencing table b
- table b contains only 1 field called id which is the PK and
also a FK referencing table c
- table c is once again a table with a couple of fields.

My question on this is, why create the linking table?

Surely the linking table can be removed and the data referenced
directly between tables a & c?

Is there a specific reason why this would need to be done?

* In this specific case, frankly, I can't see none...
It seems you have a relation Many-to-One between table a and c.
I usually place an associative table in the middle when I have a
many-to-many relationship, which is not the case.

In this scenario I would consider table b superfluous (specially
when it has no other fields except its ID) and short circuit it.

That's my oppinion

Best,
Oliver


In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Jean-Yves F. Barbier 2010-11-15 12:31:21 Re: Reasons for creating linking tables?
Previous Message Oliveiros d'Azevedo Cristina 2010-11-15 12:26:19 Re: Reasons for creating linking tables?