数据库设计 - 四级亲子关系 [英] Database Design - Four-Level Parent-Child Relationships
问题描述
这可能会有点复杂。我们有一个这样的父子关系:
项目包含许多任务。一个项目也可能有任何数量的修订版本。
这些表的数据库模式如下所示:
项目:
ProjectID
ProjectName
ProjectRevisions:
ProjectRevID
ProjectID
ProjectRevName
任务:
TaskID
ProjectRevID
TaskName
HoursToComplete
任务表格是从另一个表格Taskdescriptions填充的,其中包含任务的主列表。
我的雇主也想要subquotes - 意思是个人可以引用自己的努力与主引用分开。每次ProjectRevision发生时,子引文必须重做,所有旧版本和SubQuotes必须保留以备将来参考。
表格模式如何看待?在我看来,这本质上是一个四级列表:一个项目包含一个修订列表,它们都包含一个SubQuotes列表,每个列表都包含一个任务列表。
我可能会反思这个,但是非常感谢任何帮助
我的雇主也想要subquotes - 这意味着一个人可以引用自己的努力与主引用分开。每次发生ProjectRevision时,子引文必须重做,所有旧版本的修订版本和SubQuotes必须保留以备将来参考。
表格模式如何?在我看来,这本质上是一个四级列表:一个项目包含一个修订列表,每个列表包含一个SubQuotes列表,每个列表包含一个任务列表。
假设不会有任何一个subquote可能与多个用户有关的情况:
SUBQUOTES
表
-
SUBQUOTE_ID
,pk -
-
PROJECT_REV_ID
,fk -
USER_ID
,fk - [支持列]
我没有看到需要任何其他更改现有数据模型。
This might get a little complicated. Here goes.
Say we have a parent-child relationship like this:
A Project contains many Tasks. A Project may also have any number of Revisions.
And the database schema for these tables look something like this:
Projects:
ProjectID
ProjectName
ProjectRevisions:
ProjectRevID
ProjectID
ProjectRevName
Tasks:
TaskID
ProjectRevID
TaskName
HoursToComplete
The tasks table is populated from another table, TaskDescriptions, which contains the master list of tasks.
My employer also wants subquotes - meaning an individual can quote his own effort seperate from the master quote. Each time a ProjectRevision takes place, the Subquotes must be redone, and all old Revisions and SubQuotes must be kept for future reference.
How would this look in a table schema? In my eyes, this is essentially a four-level list: A project contains a list of Revisions, which each contain a list of SubQuotes, which each contain a list of tasks.
I may be overthinking this, but any help is greatly appreciated
My employer also wants subquotes - meaning an individual can quote his own effort seperate from the master quote. Each time a ProjectRevision takes place, the Subquotes must be redone, and all old Revisions and SubQuotes must be kept for future reference.
How would this look in a table schema? In my eyes, this is essentially a four-level list: A project contains a list of Revisions, which each contain a list of SubQuotes, which each contain a list of tasks.
Assuming there won't be any instances where a subquote could be related to more than one user:
SUBQUOTES
table
SUBQUOTE_ID
, pkPROJECT_REV_ID
, fkUSER_ID
, fk- [supporting columns]
I don't see any other changes necessary to the existing data model.
这篇关于数据库设计 - 四级亲子关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!