sqlrelational-databaseone-to-manymany-to-one

Difference between one-to-many and many-to-one relationship


What is the real difference between one-to-many and many-to-one relationship? It is only reversed, kind of?

I can't find any 'good-and-easy-to-understand' tutorial about this topic other than this one: SQL for Beginners: Part 3 - Database Relationships


Solution

  • Yes, it is vice versa. It depends on which side of the relationship the entity is present on.

    For example, if one department can employ several employees then department to employee is a one-to-many relationship (1 department employs many employees), while employee to department relationship is many-to-one (many employees work in one department).

    More info on the relationship types:

    Database Relationships - IBM DB2 documentation