0

我在创建 3NF 规范化数据库时遇到问题。有人可以帮忙吗?我看不到任何依赖项。这是一个房地产网站。表字段如下:

ID - 类型 - Loc - 村庄 - 用途 - 价格范围 - 图片 1 - 图片 2 - 图片 3 - 状态 - 属性 - 描述

任何帮助表示赞赏。

4

3 回答 3

0

Typically you'd have tables like this:

            PropertyType
            Village
            Purpose
            Status
            Property

and there could be many properties in a particular village. Purpose and PropertyType might be dependent -- you could not use a Cottage as a gathering place for a large audience, for example, though you could use a Cottage as a "Single Family Dwelling" or as "Bed and Breakfast". To represent this dependency you would need this intermediary table:

           PropertyTypePurposes
           propertytypeid
           purposeid

where for each property type you would have one or more potential purposes. Then, in your Properties table, you would not reference Purposes directly but would reference PropertyTypePurposes:

           alter table properties
           add constraint FK_PROPERTIES_PROPERTYTYPEPURPOSES
           foreign key (propertytypeid, purposeid) references PropertyTypePurposes(propertypeid, purposeid)
于 2011-07-23T15:00:06.180 回答
0

To be in 3NF, all you need to ensure is that you don't have any transitive functional depencencies (and that you don't have any non-full dependencies). If ID determines a tuple, and none of the other attributes can be used to say for certain what the value of some other attribute must be, you're not only in 3NF, but also in BCNF.

于 2011-07-23T15:00:40.063 回答
0

如果 type 是对另一个表的引用,那没关系,否则您必须将类型放在另一个表中。您也可以为图片创建一个表格。如果您想了解更多关于村庄的信息,村庄可以进入另一张桌子。

于 2011-07-23T14:53:19.173 回答