databases

Definition

Entity-Attribute-Value Model

The entity-attribute-value model is a database design pattern that stores each fact as a triple

rather than using one column per attribute.

It is useful when entities have many optional properties, or when the set of properties changes frequently.

Structure

In this model, each row describes one property of one entity.

entityattributevalue
person 17nameAlice
person 17age34
person 17cityLeeds

Trade-offs

The model is flexible, but it has clear costs.

  • It stores sparse data efficiently when many attributes are unused.
  • It allows new attributes without altering the schema.
  • It makes validation and type checking harder.
  • It often makes queries more complex, because a single logical entity is spread over many rows.
  • It can obscure first normal form style modelling and makes normalisation harder to reason about.

Example

Medical records

A medical record system may need different attributes for different kinds of patients. One patient may have blood pressure and height, while another may have allergy data and medication notes. An entity-attribute-value table can store these facts without changing the table structure each time a new property appears.

The same flexibility is also the main weakness. Values that should be constrained by strong domain rules are reduced to generic rows, so the database must enforce meaning in application code or with extra tables.