Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If this is what you're describing:</p> <pre><code> Entity ^ | EntityPropertyValue | | Property&lt;---- PropertyValue ^ | | | --------------------- </code></pre> <p>Where <code>Property</code> defines the various properties that can be applied to a given <code>Entity</code>, <code>PropertyValue</code> defines the values that are valid for a given <code>Property</code>, and <code>EntityPropertyValue</code> defines the value for a given property for a given <code>Entity</code>, then what you have is pretty much exactly EAV (just substitute the word <code>Attribute</code> for <code>Property</code> and you <em>will</em> have exactly EAV).</p> <p>There's nothing inherently wrong with this architecture, and there are certainly some circumstances where it's a valid (and possibly the <em>only</em> valid) choice. Your circumstance does sound like it's a good candidate for EAV.</p> <p>The trouble, as you've discovered, is that it can make querying difficult, especially when you're going to allow the user to specify multiple values for a given property. This will make constructing your result set difficult, as you're going to have to account for potential cartesian products. I can't give you any further advice without seeing an actual query that you're having trouble with (feel free to edit your question and post a comment on my answer; I'll revise it and add some advice if you do), but I can tell you that simply having a "myriad of tables" is not necessarily bad, and, in fact, sounds like the correct design choice given your parameters.</p>
 

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