2

我正在研究数据库设计和理论,并最终在创建基于 SQL 的模式方面进行了深思熟虑的尝试。如果有人有时间,我想检查我的布局并确保它是合乎逻辑的。旨在提高我的知识的提示和批评当然是受欢迎的!:)

这是我的总体目标:创建一个数据库,让拥有多家商店的企业能够通过简单地标记培训日期和验证日期来跟踪员工培训进度。基本上,这将是层次结构:

Business 1 
--Store Location (a)
----Employee
----Employee
----Employee
--Store Location (b)
----employee
----employee
----employee

Business 2
--Store Location (a)
----employee
----employee
--Store Location (b)
----employee
----etc...

此模式应允许无限的企业、商店和员工。

就培训而言,应该有这种类型的层次结构:

Business 1
--Employee Class           (Manager, Employee, Salesman, Associate, etc)
----Training Category      (Sales, Stocking, Manufacturing, etc)
------Training Activity    (How to sell X product, How to stock Y aisle, etc)
------Training Activity
------Training Activity
----Training Category
------Training Activity
------Training Activity
--Employee Class
----Training Category
----Training Category

Business 2
--Employee Class           
----Training Category     
------Training Activity    
------Training Activity
------Training Activity
----Training Category
------Training Activity
------Training Activity
--Employee Class
----Training Category
----Training Category

以下内容应根据业务需求而变化,并在创建业务帐户时创建:

*Number of Stores
*Number of Employees 
*Employee Classes

*Training Categories
*Training Activities

所以重要的问题是:
1)我有多接近?
2) 怎样才能做得更好?

提前致谢!

这是图表图片的链接:http: //i1227.photobucket.com/albums/ee422/CorySCline/diagram.jpg

4

1 回答 1

1

乍一看,它看起来还不错。可以说,多对多的关系应该总是被打破。例如,对于您的公司和员工表,您有一个链接到员工 ID 的公司 ID。考虑一个员工可以被 2 家所有属性相同的不同公司雇用的事实。您将没有唯一标识符。解决此问题的方法是创建一个匹配表,其中您将有 2 个属性,company_id 和employee_id(可能是一个自动增量标识符,以防万一)。

Similarly, consider an employee that moves between stores... You couldn't find out an employee's track record. Also, you do it with employee class and employee.

于 2012-11-05T19:05:37.563 回答