Skip to content
Advertisement

Advice on database design – SQL recipe editor

I want to build an SQL-based recipe editor for a brewery. I have n recipes:

  • Every recipe is part of a category.
  • Every category has a list of steps.
  • Steps can be reused in the same category several times and in different orders.
  • Every step has n set-points.
  • Setpoints change based on the recipe.
  • The same steps used more than once in the same category could have different setpoints within the same recipe.

I have 3 recipes (BeerA, BeerB and BeerC):

  • BeerA and BeerB are lager (category), while BeerC is a stout (category).
  • Lager has 5 steps
    (start, fermentation, wait, fermentation, maturation).
  • All the steps have 2 set-points
    (time, temperature).

BeerA specific set-points could be:

  • Start:
    [10seconds, 30 degrees]
  • Fermentation:
    [2 days, 27 degrees]
  • Wait:
    [3 hours, 25 degrees]
  • Fermentation:
    [3 days, 23 degrees]
  • Maturation:
    [5 days, 3 degrees]

BeerB has the same steps, same order, but with different set-points. BeerC has only 3 steps. What would be an example of table design? I was thinking:

  • Recipe table
    (RecipeID, RecipeName, categoryID).
  • Category table
    (CategoryID, CategoryName).
  • Steps table (I need the reference to the category and to the recipe).

How can I deal with steps using different set-points? I believe I need also a Setpoints table, but how to design it?

Advertisement

Answer

Note:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement