我正在为需要很大灵活性的不同程序开发评估系统。每个程序都有不同的跟踪内容,因此我需要存储他们想要跟踪的数据点,以及在特定数据点上评估的人员的相应数据。我猜几张桌子都合适。以下是一般概述:
Table: accounts
- unique ID assigned to each account. We'll call this 'aid'
Table: users
- each user with unique ID.
Table: evaluation
- each program will enter in the metrics they want to track into this table (i.e attendance)
- column 'aid' will correspond to 'aid' in account table
Table: evaluation_data
- data (i.e attendance) entered into this database
- column 'aid' will correspond to 'aid' in account table
- column 'uid' will correspond to 'uid' in user table
evaluate_data的输入表单将根据评估表中的内容生成。
这是我能想到的唯一合乎逻辑的方法。随着时间的推移,其中一些表将会变得非常大。这是最佳的做法吗?
答案 0 :(得分:0)
我对帐户,用户和程序如何相互关联以及帐户和程序是否相同以及您是否可以互换地使用这些术语感到有些困惑。我将使用不同的术语,这些术语对我来说更容易理解。
假设您有一个网站,允许自由职业者跟踪不同的项目,他们可以创建自己的数据来跟踪。 (希望你看到相似之处)
表...
<强>自由职业者强>
id title etc
<强>项目强>
id freelancer_id title description etc
<强> data_options 强>
id freelancer_id title
您甚至可以添加其他列,例如data_type,并提供URL,电子邮件,文本,日期等选项,这些选项可用于验证或帮助格式化输入表单。
示例数据:
1 5 Status
2 5 Budget
3 5 Customer
4 99 Job Type
5 99 Deadline
6 102 Price
7 102 Status
8 102 Due By
这显示3个不同的自由职业者追踪数据,自由职业者id为5,99和102.截止日期和截止日期基本相同,但自由职业者可以随意调用这些。
<强> data_values 强>
id project_id option_id option_value
列freelancer_id,因为您可以进行连接并从project_id或option_id获取freelancer_id
示例数据:
1000 1 2 $250
1001 1 1 Completed
1002 1 3 Martha Hayes
这只显示信息自由职业者,其中id为5,因为option_id的1-3属于该用户。