Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Mapping of E/R Diagram to Tables  RSS feed

 
Anil Kumar
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,

While mapping one to many relation ship between entities to tables , each of the entities gets mapped to separate table. The tables are linked to each other with the help of referential foreign key constraint. This is the normal approach one follows.

My doubt is , Is it recommended to map both the entities to a single table ?. Kindly let me know the correct approach.

Regards,
Anil
 
Mohamed Sanaulla
Bartender
Posts: 3169
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each entity would map to one table. So in case of one-many mapping the entity having the many property would have a key to identify a unique row in the other entity.

Both the entities mapped to same table would be- repetition of the data which was supposed to be appearing once, but appears many times due to its relation with the other entity. This is usually a wrong approach. Moreover you are combining two different things which can lead to a unnecessarily coupled tables.
 
Anil Kumar
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for clearing my doubt
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!