Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Perhaps you should look <a href="https://stackoverflow.com/q/695752/119477">this question</a></p> <p>The accepted answer from Bill Karwin goes into specific arguments against the key/value table usually know as Entity Attribute Value (EVA)</p> <blockquote> <p>.. Although many people seem to favor EAV, I don't. It seems like the most flexible solution, and therefore the best. However, keep in mind the adage <a href="http://en.wikipedia.org/wiki/Tanstaafl" rel="nofollow noreferrer">TANSTAAFL</a>. Here are some of the disadvantages of EAV:</p> <ul> <li>No way to make a column mandatory (equivalent of <code>NOT NULL</code>).</li> <li>No way to use SQL data types to validate entries.</li> <li>No way to ensure that attribute names are spelled consistently.</li> <li>No way to put a foreign key on the values of any given attribute, e.g. for a lookup table.</li> <li>Fetching results in a conventional tabular layout is complex and expensive, because to get attributes from multiple rows you need to do <code>JOIN</code> for each attribute.</li> </ul> <p>The degree of flexibility EAV gives you requires sacrifices in other areas, probably making your code as complex (or worse) than it would have been to solve the original problem in a more conventional way.</p> <p>And in most cases, it's an unnecessary to have that degree of flexibility. In the OP's question about product types, it's much simpler to create a table per product type for product-specific attributes, so you have some consistent structure enforced at least for entries of the same product type.</p> <p>I'd use EAV only if <em>every row</em> must be permitted to potentially have a distinct set of attributes. When you have a finite set of product types, EAV is overkill. Class Table Inheritance would be my first choice.</p> </blockquote>
    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