I have an entity type called 'Object', and I need to model an object set as a list of unique objects with variable length. Then, each object could belongs to many object sets.

**Current entity-relationship diagram (ERD)**

This is my ERD so far, with a many-to-many relationship:

**Tables design**

At this point, we have the next tables:

Object table:

- ObjectID (PrimaryKey)
- ObjectAttribute1
- ObjectAttribute2
- […]

ObjectSet table:

- ObjectSetID (PrimaryKey)
- ObjectSetAttribute1
- […]

ObjectBelongsObjectSet:

- ObjectSetID (ForeignKey)
- ObjectID (ForeignKey)

Using this model, we could have two different sets of objects with exactly the same combination of objects, which could never happen.

**My question**

How could improve my model to implement this restriction?

## Best Answer

The problem can not be solved with the relational model, but, as @jean says in the comments, we can calculate a hash of the objects that make up the set of objects and form a field with restriction of uniqueness.