我正在尝试规范化表,该表具有的属性中,该属性具有一些子属性,每个子属性还具有另外两个子属性
我的表的属性是
(
ZONE,
Province,
DISTRICT,
YEAR,
MAHA SEASON {MAHA SEASON has seven sub-attributes they are
1.Banana [Banana has two sub-attributes they are
i.Pro.
ii.Ext.]
2. Okra [Okra has two sub-attributes they are
i.Pro.
ii.Ext.],
3. Winged Bean [Winged Bean has two sub-attributes they are
i.Pro. and
ii.Ext.],
4. Brinjal [Brinjal has two sub-attributes they are
i.Pro. and
ii.Ext.],
5. Capsicum [Capsicum has two sub-attributes they are
i.Pro. and
ii.Ext.],
6. Snake Gourd [Snake Gourd has two sub-attributes they are
i.Pro. and
ii.Ext.],
7. Tomato [Tomato has two sub-attributes they are
i.Pro. and
ii.Ext.]
} ,
YALA SEASON {YALA SEASON has seven sub-attributes they are
1.Banana [Banana has two sub-attributes they are
i.Pro.
ii.Ext.]
2. Okra [Okra has two sub-attributes they are
i.Pro.
ii.Ext.],
3. Winged Bean [Winged Bean has two sub-attributes they are
i.Pro. and
ii.Ext.],
4. Brinjal [Brinjal has two sub-attributes they are
i.Pro. and
ii.Ext.],
5. Capsicum [Capsicum has two sub-attributes they are
i.Pro. and
ii.Ext.],
6. Snake Gourd [Snake Gourd has two sub-attributes they are
i.Pro. and
ii.Ext.],
7. Tomato [Tomato has two sub-attributes they are
i.Pro. and
ii.Ext.]
}
)
有关更多详细信息,请参见下图enter image description here
任何人请帮助我规范化此表
看来您有两种类型的测量-“ pro”和“ ext”。这些测量具有很多属性。这些属性中的某些似乎实际上是地理实体的属性。
location
----------
id int (pk)
zone (enum: wet/dry)
province
district
measurement
----------
id (pk)
location_id (fk)
year
season (enum: yala/maha)
measurement_type (enum: pro/ext)
measurement (float)
我指定了枚举的位置,您可能还希望将其更改为外键关系,以列出可能的选项的表的形式。我更喜欢枚举,当业务域永远不会更改时(例如,“一周内不会超过7天”),而更喜欢在业务域可能更改时使用外键。