[thelist] SQL Multiple entries in same column?
rudy
Rudy_Limeback at maritimelife.ca
Mon Nov 13 14:38:08 CST 2000
> there are two types of relationships between data:
> one-to-many, and many-to-many.
hi oliver
please allow me to expand on this a bit...
in a physical database there is only one type of relationship --
one-to-many
it is implemented through primary keys and foreign keys
the table with the primary key is on the "one" side of the relationship,
while the table with the foreign key is on the "many" side
the "one" table is also often called the "parent" table, and the "many"
table is the "child" table
multiple child rows can have the same value in their foreign keys,but
there can only be one parent row for any single value of the primary key
many-to-one is the same as one-to-many
okay, that's the physical model
from a logical or conceptual viewpoint, you will often hear about
many-to-many relationships as well
indeed, many-to-many relationships are common in real-world applications
the thing to remember, though, is that a many-to-many logical relationship
is always implemented as two one-to-many physical relationships
holler if you would like me to give examples
finally, there is also the rarer one-to-one relationship, but this is also
implemented as a one-to-many physical relationship -- think about it, one
of the tables will have a foreign key pointing to the other table, with
perhaps an additional constraint to ensure the "many" table has unique
foreign keys
hope that helps a bit
rudy
r937.com
More information about the thelist
mailing list