I
Ilan
I have two alternative designs, and I would value your opinion as to which
is better.
The problem is the old one of bitches giving birth. I want to keep track of
all those animals born on the same birth date, to the same mother.
Two table option:
tblDog
ID [PK]
LitterFK [each dog is born to a litter]
tblLitter
DogFK
Date
ID (autonumber) [PK]
My problem with the above 2 table design is that it is 'circular'. You have
a one-to-many relationship from the dog table to the litter table (Dog.ID to
Litter.DogFK) and then a one-to-many relationship from the litter table to
the dog table (from Litter.ID to Dog.LitterFK). This somehow seems wrong,
but it may be fine.
I know that there is such a thing as a 'one-to-many self join' where tables
refer to themselves through a second table. However, I am not sure if this
is applicable here, because I would expect that in a self-join relationship,
the relationship would start and end with the same field (eg, Dog.ID relates
to LitterID, which relates back to Dog.ID, for examle). But in the
relationship proposed above DogID to Litter.DogFK then to Dog.LitterFK,
there is a 'gap' in the self join.
Three table option:
tblDog
ID
LitterFK
tblLitter
DogFK
Date
ID
tblBornToLitter
DogFK [PK]
LitterFK
Here I have a third table, 'BornToLitter' with a one-to-one relationship
with tblDog. One-2-one's are a bad thing, and normally indicate that one
table is not required. In this case, the tblBornToLitter is not required,
but only if it is OK to have a 'circular'
Please confirm that I am OK sticking to the two-table approach.
Many thanks
Ilan
is better.
The problem is the old one of bitches giving birth. I want to keep track of
all those animals born on the same birth date, to the same mother.
Two table option:
tblDog
ID [PK]
LitterFK [each dog is born to a litter]
tblLitter
DogFK
Date
ID (autonumber) [PK]
My problem with the above 2 table design is that it is 'circular'. You have
a one-to-many relationship from the dog table to the litter table (Dog.ID to
Litter.DogFK) and then a one-to-many relationship from the litter table to
the dog table (from Litter.ID to Dog.LitterFK). This somehow seems wrong,
but it may be fine.
I know that there is such a thing as a 'one-to-many self join' where tables
refer to themselves through a second table. However, I am not sure if this
is applicable here, because I would expect that in a self-join relationship,
the relationship would start and end with the same field (eg, Dog.ID relates
to LitterID, which relates back to Dog.ID, for examle). But in the
relationship proposed above DogID to Litter.DogFK then to Dog.LitterFK,
there is a 'gap' in the self join.
Three table option:
tblDog
ID
LitterFK
tblLitter
DogFK
Date
ID
tblBornToLitter
DogFK [PK]
LitterFK
Here I have a third table, 'BornToLitter' with a one-to-one relationship
with tblDog. One-2-one's are a bad thing, and normally indicate that one
table is not required. In this case, the tblBornToLitter is not required,
but only if it is OK to have a 'circular'
Please confirm that I am OK sticking to the two-table approach.
Many thanks
Ilan