0

Beginner to eav model,I am having an entity table,attribute table and value table.

Entity Table

|entity_id|entity_name|

Attribute table

|attribute_id|attribute_name|

value table:

|entity_id|attribute_id|value|

For same entity_id and attribute_id I have multiple values.

e.g

entity_id attribute_id value
1 1 1.2
1 1 1.3

this causes duplicates in eav table.how to populate the data

6
  • 3
    Hi, welcome to dba.se! EAV - it's an anti-pattern! Check out this, and this. There is only one major commercial system that uses it (Magento) and that's for a very particular use case - fashion (and, even then, I think they shouldn't have used EAV - personal opinion). As a basic first principle of db design - every entity should be a table of its own!
    – Vérace
    Oct 7, 2022 at 11:10
  • 1
    If you want to have multiple values either extend the key or use a collection of some kind (for example array) for value. EAV will lead you into all kinds of trouble and is nost of the time the wrong way to go. Concider rethinking your design, cry once now or cry forever after. Oct 7, 2022 at 11:11
  • Thanks for the response.
    – Atchaya
    Oct 7, 2022 at 11:22
  • EAV does not require attribute per entity uniqueness. But general logic needs in priority ordering which must be provided.
    – Akina
    Oct 7, 2022 at 11:45
  • @akina can you please elaborate priority ordering
    – Atchaya
    Oct 8, 2022 at 10:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.