数据库规范化 - 此示例是否违反了1NF?

时间:2011-12-21 15:53:56

标签: database database-design ms-access database-normalization

我正在使用Access 2010。 我正在为公共艺术项目开发一个数据库 - 我们在墙上绘制大型壁画。 该数据库将城市中的空白墙作为壁画的潜在场所。它包括有关建筑本身和周围房产的信息,例如墙面所在的地段。

我的主要问题是关于WallsMaster表。正如你所看到的那样,大约有30个领域...还有大约10-15个领域,我正在考虑添加,导致45个领域,甚至更多。就数据库性能而言,将这些表分成多个表或将它们全部保存在一个表中是否更好?也就是说,我应该打破WallsMaster还有另一个表格来覆盖我在这个表格中的一般类别....也许叫做Damage和一个叫做Obstruction,一个叫做FacesLot等......然后在他们和WallsMaster之间建立FK关系?

我正在考虑规范化规则......只是不确定这些规则是否与1NF相关的相关/重复数据组合格。我的理解是,更多的是没有像AuthorName,Book1,Book2,Book3等的表格。

这是我的数据库的粗略架构:

Table: WallsMaster
WallID (PK)
StreetAddress
City
State
Zip
BldgName
Occupied_or_Vacant
Faces_Direction (NSEW)
Residential_or_Commercial
Historical_Property (Yes/No)
Visible_to_traffic (Yes/No)
Faces_Parking (Yes/No)
Faces_Fenced_Lot (Yes/No)
Faces_Abandoned_Lot (Yes/No)
Faces_Garden (Yes/No)
Faces_ParkPlayground (Yes/No)
Faces_street (Yes/No)
Wall_Surface (Lookup: Brick, Stucco, etc)
Damage_Water (Yes/No)
Damage_Crumbling (Yes/No)
Damage_Graffiti (Yes/No)
Damage_Other (Yes/No)
Obstruction_Trees (Yes/No)
Obstruction_Powerlines (Yes/No)
Obstruction_Other (Yes/No)
Number_Stories
Height
Width
Image (Link)
GoogleStreetView (Link)
Notes (memo field)

Table: WallContacts
ContactID (PK)
WallID (FK)  many:many.  i.e., one wall can have many contacts (owner, manager, tenant) and one contact can be affiliated with many properties (i.e., one owner owns several walls)
FirstName
LastName
Address
City
State
Zip
ContactType (Lookup: Owner, Manager, Neighbor, etc.)
Phone
Email

Table: WallInteraction  (Catalogs each time our staff talks to someone affiliated with that wall or conducts an inspection of the property, etc)
InteractionID(PK)
WallID (FK)
StaffName
Date
InteractionStatus
Notes
(this may expand to include more fields as we work with this more)

谢谢!

1 个答案:

答案 0 :(得分:3)

我不会将WallMaster拆分成多个表格,如果这些是您需要为墙壁建模所需的字段,那么请将它们包含在墙桌中。

  • 如果建筑物可以有多个墙壁,那么我会将地址等因素分解为一个单独的建筑物表格,并以一对多的关系将其链接到WallMaster(建筑物可以有很多墙,但墙只能属于一个建筑物)
  • 您可能需要考虑将Notes分解(与WallsMaster一对多),因为这样您就可以输入多个音符并保留历史记录而不是覆盖现有音符。
  • 在WallInteraction上考虑一个StaffID外键而不是StaffName。
  • 我个人也会将'WallMaster'重命名为'Wall'。