Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think that something has been lost in translation over here, but I did my best to make an <strong>ER</strong> diagram of this.</p> <p>In general, there are two approaches. The first one is to propagate keys and the second one is to have an auto-increment integer as a <strong>PK</strong> for each table.</p> <p>The second approach is often driven by ORM tools which use a <strong>DB</strong> as object-persistence storage, while the first one (using key propagation) is more common for hand-crafted <strong>DB</strong> design.</p> <p>In general, the model with key propagation offers better performance for "random queries", mostly because you can "skip tables" in joins. For example, in the model with key propagation you can join the <code>Purchase</code> table directly to the <code>Item</code> table to report purchases by <code>ItemName</code>. In the other model you would have to join <code>Price</code> and <code>ItemPriceCategory</code> tables too -- just to get to the <code>ItemID</code>.</p> <p>Basically, the model with key propagation is essentially relational -- while the other one is object-driven. ORM tools either prefer or enforce the model with separate ID (second case), but offer other advantages for development.</p> <p>Your example seems to be trying to use some kind of a combination of these two -- not necessarily bad, it would help if you could talk to original designer. </p> <hr> <p><strong>With key propagation</strong></p> <p><img src="https://i.stack.imgur.com/5p7Mg.png" alt="enter image description here"></p> <hr> <p><strong>Independent keys for each table</strong> <img src="https://i.stack.imgur.com/1IBRB.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload