zan
zan

Reputation: 95

mapping a relationship on an ER diagram if it won't be used in practice?

I have the following tables:

______________         ___________      ___________
Persons       |        Enquiries  |     Products   |
______________|        ___________|     ___________|
PersonID      |        EnID       |     ProductID  |
FirstName     |        EnDate     |     Product    |
LastName      |        Enquiry    |     Price      |
Email         |        ___________|     ___________|
Etc.          |
______________|

I'm going to make a 1:N relationship between Persons and Enquiries. There's also an explicit M:N relationship between Enquiries and Products. However, There's no need for the business folks to record whether an enquiry is about a particular product or not.

My question: From a logical design point of view, do I still need to record the relationship on the ER diagram and implement it within my RDMBS even if I'm not going to make any use of it?

Many thanks, zan

Upvotes: 1

Views: 234

Answers (3)

yurisich
yurisich

Reputation: 7119

From my experience, if you're even asking this question, then you need to make the table.

From the sounds of your question, you have feelings that there may be a use for mapping the statistics between Enquiries and Products, either now or in the future.

Many-to-Many tables, when implemented in this fashion:

      Product-Enquiries
=============================
P_ID-E_ID  PK, int, AUTO_INCR 
P_ID       FK, int
E_ID       FK, int

Are very small tables, take less than five minutes to set up, and can be ignored with little consequence. However, the moment it enters someone's head that "hey, we should be able to tell which products people are asking about", the act of creating these types of tables, as well as implementing the DML into the application logic becomes a pain.

Plus, all you have to do is write your SELECTs to get the complete listing of information regarding the topic available in the system, instead of waiting until there's been a buildup of records in the table to answer the question.

Upvotes: 1

Pankaj Upadhyay
Pankaj Upadhyay

Reputation: 13594

Relationship between tables are created only for purposes. If you are the developer and you won't be developing something that uses the relationship between product and enquiries table, then why create it.

RDBMS doesn't promote or restrict the creation of relationship. Create them if required, else leave them.

Upvotes: 1

fluca1978
fluca1978

Reputation: 4068

I guess you can cut out the relationship if you know it will never be used. This will keep the design simpler and more manageable. Or you can merge the two entities into the Enquiries one.

Upvotes: 1

Related Questions