求助 组织结构数据库设计
某公司组织结构如下所示:
XX Company
|
|
--------------------------------------------
| | |
| | |
Location1 Location2 Location3
|
|
-----------------
| |
| |
Branch1 Branch2
|
|
-----------------
| |
| |
Department1 Department2
也就是说在一个Location下可有多个Branch,一个Branch下也可有多个Department。
Table设计如下:
表名: tblLocation: tblBranch: tblDept:
属性: LocationID primary key BranchID primary key DeptID primary key
属性: LocationName BranchName DeptName
属性: LocationID foreign key BranchID foreign key
但是同事认为在tblBranch中BranchID和LocationID组合起来作为该表的primary key
然后在表tblDept中增加属性LocationID,让LocationID作为外键。
应为他们认为那样设计的话,使用起来不方便。
还有的同事认为应该把这三个表整合起来用一个表,如下所示:
表名: tblXXCompany
属性: LocationID primary key
属性: LocationName
属性: BranchID primary key
属性: BranchName
属性: DeptID primary key
属性: DeptName
我参考了http://www.itpub.net/thread-990453-1-1.html
还希望高手指点一下,我在这里先谢谢各位了!