T
Tom
I need some help with creating relationships and
maintaining data integrity.
A few weeks ago, I posted a thread in which I asked how
to built a simple One-to-Many relationship between 2
tables (tblJobs & tblEmployees). Basically, I needed
a "relationship" that allows to have i.e.
- 10 employees linked to
- 8 jobs
[Note: There might be a number of positions to which I
have temporarily more than 1 employee linked to -
"transition" of a position would be such an example].
One of the answers was provided by Ken (MVP) who
suggested to use a "junction table".
Here's his reply (which will illustrate the initial task
at hand as well):
*******************************************
"Try a three table design:" [Ken]
tblJobs
JobID JobTitle
(JobID is Autonumber Primary Key)
tblEmployees
EmpID EmpName
(EmpID is Autonumber Primary Key)
tblJobAssignments
JobID EmpID
(both fields Long Integer)
(Primary Key: JobID, EmpID)
(Relationship: JobID foreign key to tblJobs.JobID, one
to many)
(Relationship: EmpID foreign key to tblEmployees.EmpID,
one to many)
tblJobs Contents (JobID contents determined by Access):
JobID JobTitle
==================
51 Analyst
52 Engineer
53 Manager
54 Analyst II
tblEmployees Contents (EmpID contents determined by
Access):
EmpID EmpName
================
121 Jack
122 Ben
123 Sue
124 Carol
125 Mike
126 Tom
tblJobAssignments Contents:
JobID EmpID
===============
51 121
52 122
52 123
53 124
53 125
54 126
*******************************************
This design worked perfectly at that time; however, I now
need to link additional tables into such architecture.
Let's say I duplicate this "structure" for yet another
similar scenario. For instance, I might have
also "cases" that have multiple comments.
This would leave me with two independent "3-table"
designs that somehow need to be linked.
Not also do I need to link them in some fashion, I
probably (I emphasize probably since I not entirely
certain if this is the best way) will have also a One-To-
One relationship between the "tblJobs" and another table.
Essentially this is how I currently have the
relationships set up (I already know that they are wrong
due to record duplications):
RELATIONSHIPS DIAGRAM (this does not include the "3-
table" design yet)
__________RELATIONSHIPS "DIAGRAM"________________________
tbl_IncomingCommunication to tbl_IncomingCommuncition_ Ref
- linked via PK SERIALNO to FK SERIALNO
- 1 to ∞
tbl_IncomingCommunication to tbl_Distribution
- linked via PK SERIALNO to PK SERIALNO
- 1 to 1
tbl_Distribution to tbl_Location
- linked via PK SERIALNO to FK SERIALNO
- 1 to ∞
tbl_Distribution to tbl_Sub_Actions
- linked via PK SERIALNO to FK SERIALNO
- 1 to ∞
tbl_OutgoingCommunication to tbl_OutgoingCommuncition_ Ref
- linked via PK OCID to FK OCID
- 1 to ∞
tbl_OutgoingCommunication to tbl_IncomingCommunication
- linked via PK OCID to FK OCID
- 1 to 1; Left Outer Join
===============
___________________________________________
As one may realize I have some mediocre "knowledge" of
database design. But I truly know that the above design
won't work.
I truly would appreciate if someone could please provide
some help as to how I
- may should merge/breakup the tables (this may be tuff
though since I didn't provide much detail on other
fields).
- create proper relationships via using different PKs and
FKs
I truly need somebody's help here!!!
Thanks in advance,
Tom
maintaining data integrity.
A few weeks ago, I posted a thread in which I asked how
to built a simple One-to-Many relationship between 2
tables (tblJobs & tblEmployees). Basically, I needed
a "relationship" that allows to have i.e.
- 10 employees linked to
- 8 jobs
[Note: There might be a number of positions to which I
have temporarily more than 1 employee linked to -
"transition" of a position would be such an example].
One of the answers was provided by Ken (MVP) who
suggested to use a "junction table".
Here's his reply (which will illustrate the initial task
at hand as well):
*******************************************
"Try a three table design:" [Ken]
tblJobs
JobID JobTitle
(JobID is Autonumber Primary Key)
tblEmployees
EmpID EmpName
(EmpID is Autonumber Primary Key)
tblJobAssignments
JobID EmpID
(both fields Long Integer)
(Primary Key: JobID, EmpID)
(Relationship: JobID foreign key to tblJobs.JobID, one
to many)
(Relationship: EmpID foreign key to tblEmployees.EmpID,
one to many)
tblJobs Contents (JobID contents determined by Access):
JobID JobTitle
==================
51 Analyst
52 Engineer
53 Manager
54 Analyst II
tblEmployees Contents (EmpID contents determined by
Access):
EmpID EmpName
================
121 Jack
122 Ben
123 Sue
124 Carol
125 Mike
126 Tom
tblJobAssignments Contents:
JobID EmpID
===============
51 121
52 122
52 123
53 124
53 125
54 126
*******************************************
This design worked perfectly at that time; however, I now
need to link additional tables into such architecture.
Let's say I duplicate this "structure" for yet another
similar scenario. For instance, I might have
also "cases" that have multiple comments.
This would leave me with two independent "3-table"
designs that somehow need to be linked.
Not also do I need to link them in some fashion, I
probably (I emphasize probably since I not entirely
certain if this is the best way) will have also a One-To-
One relationship between the "tblJobs" and another table.
Essentially this is how I currently have the
relationships set up (I already know that they are wrong
due to record duplications):
RELATIONSHIPS DIAGRAM (this does not include the "3-
table" design yet)
__________RELATIONSHIPS "DIAGRAM"________________________
tbl_IncomingCommunication to tbl_IncomingCommuncition_ Ref
- linked via PK SERIALNO to FK SERIALNO
- 1 to ∞
tbl_IncomingCommunication to tbl_Distribution
- linked via PK SERIALNO to PK SERIALNO
- 1 to 1
tbl_Distribution to tbl_Location
- linked via PK SERIALNO to FK SERIALNO
- 1 to ∞
tbl_Distribution to tbl_Sub_Actions
- linked via PK SERIALNO to FK SERIALNO
- 1 to ∞
tbl_OutgoingCommunication to tbl_OutgoingCommuncition_ Ref
- linked via PK OCID to FK OCID
- 1 to ∞
tbl_OutgoingCommunication to tbl_IncomingCommunication
- linked via PK OCID to FK OCID
- 1 to 1; Left Outer Join
===============
___________________________________________
As one may realize I have some mediocre "knowledge" of
database design. But I truly know that the above design
won't work.
I truly would appreciate if someone could please provide
some help as to how I
- may should merge/breakup the tables (this may be tuff
though since I didn't provide much detail on other
fields).
- create proper relationships via using different PKs and
FKs
I truly need somebody's help here!!!
Thanks in advance,
Tom