我应该如何将丈夫,妻子和孩子彼此联系起来? [英] How should I link husbands, wives, and kids to each other?

查看:61
本文介绍了我应该如何将丈夫,妻子和孩子彼此联系起来?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个将用作教会目录的数据库。除此之外,他们还想跟踪配偶和孩子。我不想在同一张表中有一个丈夫的名字字段和妻子的名字字段(规范化理论),但我不知道如何将它们放在单独的表中,因为它们也将单独列出。我可以为配偶使用一个组合框,并根据同一个表创建一个子表单来链接孩子们(因为你不知道他们有多少孩子,数据表子表格似乎要走了)。问题是如果子表单基于与主表单相同的表,则不存在要链接的主键/外键组合。


也许我应该问这是否可行。我知道我可以在文本框中键入配偶和孩子的名字而不将它们链接到任何表格,但这实际上违背了数据库的目的。

解决方案


我不想在同一张表中有一个丈夫名字字段和妻子名字字段(规范化理论),



为什么不呢?

我猜你担心重复的姓氏。所有家庭都没有独特的姓氏。

我会使用一个列出所有个人信息的人表。

名字,DOB,出生地...所有共同的所有人。

将它们放在单独的桌子中没有多大意义。


每个人都有一个ID,可能出现在家庭中表格看起来像

展开 | 选择 < span class =codeDivider> | Wrap | 行号


而不是[ChildID],我会改用[ParentID]。而不是[HusbandID]和[WifeID]我会使用[SpouseID]。如果你想要一些东西来表明配偶的性别,那么可以单独存储,但我怀疑每个人的记录都有自己的某种性别指标,所以这可以用来确定配偶关系的类型。

这是我将如何解决的问题。

展开 | 选择 | Wrap < span class =codeDivider> | 行号


I''m creating a database that will be used as a church directory. Among other things, they are wanting to keep track of spouses and kids. I don''t want to have a husband first name field and a wife first name field in the same table (normalization theory), but I don''t know how to put them in separate tables since they will also be listed individually. Can I use a combo box for the spouse and create a subform based on the same table to link the kids (since you don''t know how many kids they have, a datasheet subform seems the way to go). The problem is there isn''t a primary key/foreign key combination to link if the subform is based on the same table as the main form.

Maybe I should be asking if this is possible. I know that I could just type the names of the spouse and kids in textboxes without having them linked to any table, but that really defeats the purpose of the database.

解决方案

I don''t want to have a husband first name field and a wife first name field in the same table (normalization theory),

Why not?
I am guessing you are worried about repeated surnames. All families do not have unique surnames.
I would use a ''person'' table listing all personal information.
Names, DOB, birthplace... all common to all persons.
It makes less sense to have them in seperate tables.

Each could have an ID, that could appear in a ''family'' table looking something like

Expand|Select|Wrap|Line Numbers


Rather than [ChildID]s, I''d use [ParentID]s instead. Rather than [HusbandID] and [WifeID] I''d use [SpouseID] instead. If you want something to indicate the gender of the spouse then that can be stored separately, but I suspect each Person record would have its own gender indicator of some sort, so that could be used to determine the type of spousal relationship.


Here''s how I would lay it out.

Expand|Select|Wrap|Line Numbers


这篇关于我应该如何将丈夫,妻子和孩子彼此联系起来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆