Relationships
There are several types of relationships in databases.
- One to one relationship.
- One to many relationship.
- Many to many relationship.
One to one
One to many relationship.
For a one-to-many relationship, the model on the "many" side is responsible for storing the relationship. Why? Beside each object on the "many" side is related to just one entity on the "one" side, thus it only needs to store a single value to maintain the relationship.