A
A
asm0dey2011-01-19 13:29:57
SQL
asm0dey, 2011-01-19 13:29:57

Database organization

Probably a similar question has already been asked, but I do not know how to search correctly.

I decided to make a database of cocktails for myself.
The idea is very simple:
Plate A - the name of the cocktail, the text of the recipe, probably a picture.
Plate B - an ingredient, probably a picture, probably a description

And one more plate that allows you to see all the ingredients and their quantities for each cocktail.
Accordingly, the problem arises - how to properly store all its ingredients with quantities for a cocktail.

That is, a cocktail: ingredient 1: n1 ml, ingredient 2: n2 ml ...

I'm going to implement it on PostpresSQL, but if the choice is bad, then tell me which is better and I'll change my mind.
I write the shell in Java, I would like to use SpringRoo ...

Thank you very much for your attention.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Zheltyakov, 2011-01-19
@asm0dey

Depends on resource overload.
— If up to a couple of thousand visitors a day, then you need a "classic" version:
+ "Cocktails" table: id, title, link to image, description.
+ Table "Ingredients": id, title, link to image, description.
+ Table "Composition": id, cocktail_id, ingredient_id, quantity.
- If the load is greater than in the first case, then I advise you to either actively use caching (if possible), or add a table of intermediate results to the first option (for example, with serialized selections for ingredients or generally complete data for cocktails) and create functions that form them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question