T
Tom Bock
I need some help with the design of tables structure and their
relationships.
The following is a generic outline of the tables and some example data:
***************************************************
TABLE_DIVISION
==============
PKID_DIV DivisionName
-------- ------------
1 Division1
2 Division2
***************************************************
TABLE_BRANCH
==============
FKID_DIV PKID_BRANCH BranchName
----------- ---------- ----------
1 1 Branch1
1 2 Branch2
2 3 Branch3
***************************************************
TABLE_TASK_BRANCH1
====================
FKID_DIV FKID_BRANCH PKID_TASKNO_BRANCH1 TASKNO_BRANCH1
-------- ----------- --------------------------------
------------------------
1 1 1
1
1 1 2
1.1
1 1 3
1.1.1
1 1 4
1.1.1.1
1 1 5
1.1.1.2
1 1 6
2
1 1 7
2.1
etc.
TABLE_TASK_BRANCH2
====================
FKID_DIV FKID_BRANCH PKID_TASKNO_BRANCH2 TASKNO_BRANCH2
-------- ----------- --------------------------------
------------------------
1 2 1
1
1 2 2
1.1
1 2 3
2
1 2 4
2.1
1 2 5
2.1.1
1 2 6
2.1.2
etc.
TABLE_TASK_BRANCH3
====================
FKID_DIV FKID_BRANCH PKID_TASKNO_BRANCH3 TASKNO_BRANCH3
-------- ----------- --------------------------------
------------------------
2 3 1
1
2 3 2
1.1
2 3 3
2
2 3 4
3
2 3 5
3.1
etc.
***************************************************
Essentially, I will have the following:
- Multiple division which have
- multiple branches which have
- multiple tasks numbers (plus other fields)
As expected, the task numbers might be unique in some branches while they
also could be found in more than just one table.
For instance:
- Division1/Branch1 may be the only div/branch that does "Research"
- while Division1/Branch1 as well as Division1/Branch2 does some "Admin
Work"
So my questions are:
- How do I construct the relationships (primary and foreign keys) between
these tables?
- Obviously, I must be able to query on e.g. "find all divisions/branches
that do ADMIN WORK" (which there are multiple div/branches).
- What are the data types for any primary or foreign keys? (autonumber vs.
number)?
- IMPORTANT... the TASKNO_BRANCH field must be a "text field" (multiple dots
e.g. "1.1.1.1")
Any suggestions are highly appreciated!!!
Tom
relationships.
The following is a generic outline of the tables and some example data:
***************************************************
TABLE_DIVISION
==============
PKID_DIV DivisionName
-------- ------------
1 Division1
2 Division2
***************************************************
TABLE_BRANCH
==============
FKID_DIV PKID_BRANCH BranchName
----------- ---------- ----------
1 1 Branch1
1 2 Branch2
2 3 Branch3
***************************************************
TABLE_TASK_BRANCH1
====================
FKID_DIV FKID_BRANCH PKID_TASKNO_BRANCH1 TASKNO_BRANCH1
-------- ----------- --------------------------------
------------------------
1 1 1
1
1 1 2
1.1
1 1 3
1.1.1
1 1 4
1.1.1.1
1 1 5
1.1.1.2
1 1 6
2
1 1 7
2.1
etc.
TABLE_TASK_BRANCH2
====================
FKID_DIV FKID_BRANCH PKID_TASKNO_BRANCH2 TASKNO_BRANCH2
-------- ----------- --------------------------------
------------------------
1 2 1
1
1 2 2
1.1
1 2 3
2
1 2 4
2.1
1 2 5
2.1.1
1 2 6
2.1.2
etc.
TABLE_TASK_BRANCH3
====================
FKID_DIV FKID_BRANCH PKID_TASKNO_BRANCH3 TASKNO_BRANCH3
-------- ----------- --------------------------------
------------------------
2 3 1
1
2 3 2
1.1
2 3 3
2
2 3 4
3
2 3 5
3.1
etc.
***************************************************
Essentially, I will have the following:
- Multiple division which have
- multiple branches which have
- multiple tasks numbers (plus other fields)
As expected, the task numbers might be unique in some branches while they
also could be found in more than just one table.
For instance:
- Division1/Branch1 may be the only div/branch that does "Research"
- while Division1/Branch1 as well as Division1/Branch2 does some "Admin
Work"
So my questions are:
- How do I construct the relationships (primary and foreign keys) between
these tables?
- Obviously, I must be able to query on e.g. "find all divisions/branches
that do ADMIN WORK" (which there are multiple div/branches).
- What are the data types for any primary or foreign keys? (autonumber vs.
number)?
- IMPORTANT... the TASKNO_BRANCH field must be a "text field" (multiple dots
e.g. "1.1.1.1")
Any suggestions are highly appreciated!!!
Tom