Search code examples
databasedatabase-designassociationsmodel-associations

Database Design: Creating an association of an association


I have a database design issue and I'm not sure which of my alternatives I should go with.

I have a system that shows a politician's votes on every issue. Users can log in and "support" that politician on each issue. I'm not sure how the associations should work. Here is a picture of two alternatives:

http://i1068.photobucket.com/albums/u447/dmoss18/ScreenShot2012-05-03at111656AM.png

Option 1: A politician has many votes on many issues. A user supports each politician's vote.

Option 2: A user supports a politician on a certain issue (an association table with three foreign keys).

Is option 2 not feasible at all? Is it bad practice to associate three tables in one entity? Which option is considered best practice?


Solution

  • I would prefer option (1) because it shows that the user supports the particular vote. In option (2) it would seem to be possible (without additional constraints) for a user to support a certain politician on a certain issue when that polititian has never voted on it at all! (Of course if that is a desirable possibility then you must go for option (2)).