-
Notifications
You must be signed in to change notification settings - Fork 13
Dapper.SimpleSave and cardinality
Bart Read edited this page Oct 30, 2015
·
3 revisions
Cardinality, in the context of a relational database, for two related tables, describes the kind of relationship that they have with eachother.
For example, for tables A and B, respectively:
- One to one (1:1) means one record in A is related to one record in B; we relax this definition to say at most one record in B

- One to many (1:N) means one record in A is related to (potentially) many records in B

- Many to one (N:1) means (potentially) many records in A relate to one record in B

- Many to many (M:N) means (potentially) many records in A relate to (potentially) many records in B

Many to many relationships can't be directly modeled in a relational database so they're generally implemented using a link table. For example, for an M:N relationship between tables A and B we create a link table AB'. The relationship between A and AB' is 1:N, whilst the relationship between AB' and B is N:1. Thus we are able to link many records in A to many records in B using the AB' table.
