N
Nocturnal
I'm having a hard time understanding this. Can anyone try to explain this
in laymans terms?
in laymans terms?
Graham R Seach said:Cardinality simply defines the numeric relationship between two
objects. In Object-Oriented (OO) terms, cardinality can be 0, 1, or
many, and it applies to both ends (directions) of the relationship.
What this all means in terms of database design, is that cardinality
defines whether a relationship between the data in two tables is
classified as one-to-one, one-to-many, or many-to-many.
Where two tables participate in a mutual dependence:
* a one-to-one relationship is where a record in one table
(Table-A) can only be related to one record in the other table
(Table-B). Going the other way, any record in Table-B can only be
related to one record in Table-A.
* a one-to-many relationship is where a record in Table-A can be
related to any number of records in Table-B, but the reverse is not
true. Any record in Table-B can only be related to one record in
Table-A.
* a many-to-many relationship is where a record in Table-A can be
related to many records in Table-B, and (in contrast to the
one-to-many relationship) the reverse IS true. The many-to-many
relationship also permits any record in Table-B to be related to many
records in Table-A.
In true OO, you can have a cardinality of zero-to-one or
zero-to-many, but sensibly this is not implemented in databases. What
is also not implemented natively in Access is the many-to-many
relationship. To create this relationship in Access, you must create
an intermediate table (Table-C) between the two tables in question.
In this model, the relationship between Table-A and Table-B is
one-to-many, and the relationship between TableB and Table-C is also
one-to-many. The combination of the three tables implements an
effective many-to-many relationship.
To answer your real question about what constitutes minimum and
maximum cardinality; if we take the example of a one-to-many
relationship, "one" is the minimum cardinal, and "many" is the
maximum. Similarly, in a zero-to-one relationship (which as you
recall can't be implemented in databases), "zero" is the minimum, and
"one" is the maximum.
Old math majors don't have the same issues.![]()
Graham R Seach said:Dirk,
Yes, you can define cardinality that way, because object relationships can
be declared as mandatory or optional, but it's not mormally done that way.
That sort of relationship is usually declared in use case scenarios, and in
specs, because it can't be enforced architecturally. Applying a strict data
modelling definition, cardinality refers to the number of associations that
naturally (architecturally) occur between objects.
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
Graham R Seach said:Ralph,
Yes, although I touched on OO modelling in my original post, you can see
that I was referring to the relational model as it specifically pertains to
Access. And it's for that reason that I mentioned the inability (in Access
tables/relationships - architecturally) to define the type of constraints
that Dirk raised.
Perhaps I should have clarified "...but it's not mormally done that way", to
specify "in Access".
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
Fred Boer said:Well, I hope it helped the OP, 'cause it gave me a case of the screaming,
full-bore, math-phobic heebie jeebies! :-O
I'll be ok, though... I can get through this... ok, Fred, keep calm... don't
think about numbers... keep thinking about Catholics in red robes and little
red birds...