Entity Relationship question
We are in the process of redesigning our datamodel and I have a question around the best way to relate one entity to another.
We have several scenarios where this applies but I will use one for illustration.
Tables as follows
Documents
Users
Clients
A document could could relate to one Client, to one User or to both one User and one Client. So my question is am I best to use a intermediate table to relate them such as
Document_Entity de
de.entity_type
de.entity_id
or add a Document.user_id and a Document.client_id column to the Documents table.
As I see it the advantage to an intermediate table is flexibility and no empty columns.
The advantage of adding columns in the Document table is simplicity and faster joining assuming I have many Documents, Users and Clients. In the past we have opted for the latter and think that is the way to go but any insight would be greatly appreciated.
Thanks
Subject
Written By
Posted
Entity Relationship question
February 18, 2011 04:31PM
February 18, 2011 05:30PM
February 25, 2011 03:24AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.