Table with unknown number of columns?

F

fraro

Hi!

Im very new with Acess 2007 so I have a question.
I have created 2 tables.
The first one is info about the dish.
The second one should contain all the ingrediens for the dish.
But here's my problem...
1 column / ingrediens? Every dish is diffrent. Easy to put the amount in a
column.
1 column with all the ingrediens? Where should I put the amount (1 litres etc)

I have an idea of creating another table with prices on the ingrediens so I
can see the price of the dish. Not now...

I hope you understand my question.

You can answer in swedish to my e-mail: (e-mail address removed)
 
B

Baz

dishes table:
========
dish_name (PK)

ingredients table:
===========
ingredient_name (PK)
ingredient_price

dish_ingredients table:
===============
dish_name (PK)
ingredient_name (PK)
quantity
 
F

fraro

Is this right? If there are 2 ingredients in one dish and 20 in another, does
this still work?
 
D

Douglas J. Steele

It sure will work.

The only issue is that you can't list the same ingredient more than once for
a given recipe. Depending on how you're doing your recipes, that may or may
not be an issue. (I know some people like to group ingredients by
instructions, so that it's possible to have a quarter cup of sugar in one
part of the recipe, and a half cup of sugar in another part)
 
B

Baz

Yes. Table dish_ingredients has two records for one dish and twenty records
for the other. The correct way to handle multiple values in a relational
database is with multiple rows, not multiple columns.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top