Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Logically, this would be an identifying relationship, since a form field cannot exist without a form.</p> </blockquote> <p>No, identifying relationship is about identification, not existence.</p> <p>Any X:Y relationship where X >= 1 guarantees existence of the left side, whether identifying or not. In your case, a 1:N relationship guarantees existence of <code>form</code> for any given <code>form_field</code>. You could make it identifying or non-identifying and it would still guarantee the same.</p> <p>Remarks:</p> <ul> <li>You would model an identifying relationship by making <code>form_field.form_id</code> part of a key. For example <code>form_field</code> PK could look like: <code>{form_id, label}</code>, which BTW would be quite beneficial for proper <a href="http://use-the-index-luke.com/sql/clustering/index-organized-clustered-index">clustering</a> of your data (InnoDB tables are <a href="http://www.ovaistariq.net/521/understanding-innodb-clustered-indexes/">always clustered</a>).</li> <li>Just making a PK: <code>{id, form_id}</code> would be incorrect, since this superkey is not a candidate key (i.e. it is not minimal - we could remove <code>form_id</code> from it and still retain the uniqueness).</li> <li>You would model a 0..1:N relationship by making the <code>form_field.form_id</code> NULL-able (but then you wouldn't be able to make it identifying as well - see below).</li> </ul> <p>There are two definitions of the "identifying relationship":</p> <ul> <li><strong>Strict definition</strong>: A relationship that migrates parent key into child primary key<sup>1</sup>.</li> <li><strong>Loose definition</strong>: A relationship that migrates parent key into child key.</li> </ul> <p>In other words, the loose definition allows migration into alternate key as well (and not just primary).</p> <p>Most tools<sup>2</sup> seem to use the strict definition though, so if you mark the relationship as identifying, that will automatically make the migrated attributes part of the child PK, and none of the PK attributes can be NULL.</p> <hr> <p><em><sup>1</sup> Which is then either completely comprised from migrated attributes, or is a combination of migrated attributes and some additional attributes.</em></p> <p><em><sup>2</sup> ERwin and Visio do. I haven't used MySQL Workbench for modeling yet, but your description seems to suggest it behaves the same.</em></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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. 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