5

I try to design database tables for the case shown below. I also have an account defined, but it's not important regarding my problem.

There is a list of operations (expenses). Each operation can take place in specified POI, places can be grouped in chains (optional). Each operation can have a recipient, specifically a shop chain.

My current design looks like below. I could even remove chain table in favor of direct reference to recipient, but it still leaves a loop between tables. Effectively, single row could contain references to place and receiving account having different recipient defined.

database design

The only solution I can see is a table check to exclude described case, but I'm wondering: is there a better fix?

Krzysztof Antoniak
  • 451
  • 1
  • 6
  • 20

1 Answers1

4

As far as I can tell there isn't anything fundamentally wrong with your design. There's no need to change it just because it contains a loop. The loop in this case doesn't even appear to be a circular dependency. If you believe your current design accurately models what it is intended to then I see no need to change it.

nvogel
  • 24,981
  • 1
  • 44
  • 82
  • Any suggestions regarding avoiding data redundancy in this case? – Krzysztof Antoniak Jan 03 '16 at 15:44
  • Just the usual suggestions: understand the fundamentals and do your analysis then apply sensible design principles (Fifth Normal Form, the Principle of Orthogonal Design). – nvogel Jan 04 '16 at 11:11