包含测量的记录不需要知道或关心它们存储的测量类型。只是价值。它可能像这样简单:
Ingredients
----------
ID
Name
MeasurementTypes
----------
ID
Name
Measurements
----------
ID
IngredientID
MeasurementTypeID
RecipeID
Amount
Description
Recipes
----------
ID
Name
Description
在上面的设计中,成分是面粉、糖、鸡蛋等。测量类型是杯子、盎司、计数等。食谱是带有标题和描述的主要食谱本身。测量是食谱的多对一子,将它们与成分联系起来。因此,示例记录可能是:
Recipes
----------
1 Ramen Noodle Soup Boil water, add noodles, stir, eat.
Ingredients
----------
1 Instant Ramen Noodle Soup
2 Water
MeasurementTypes
----------
1 Packages
2 Cups
Measurements
----------
1 1 1 1 1 Use one package of instant Ramen Noodle Soup.
2 2 2 1 2 Use two cups of water.