maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Database structure (https://talk.maemo.org/showthread.php?t=63729)

Lullen 2010-10-12 16:22

Database structure
 
I have never done a database before and have no idea where to start reading for these questions but I think the documentation at trolltech is enough if I just get up a layout of the database.

So the problem is that I want to make a database wich stores recipes that have a name, a category and x ingredients. I can do it by having like 20 fields for each recipe but I have a feeling you can do it much easier if you link it to another field or so! Any ideas?


Yours,

Diph 2010-10-12 16:44

Re: Database structure
 
Maybe you can use three tables:

RECIPE(id, name, category)
INGREDIENT(id, name)
RECIPE_INGREDIENT(recipe_id, ingredient_id, amount etc...)

bonapart 2010-10-12 17:03

Re: Database structure
 
i think that two tables will be enough
RECIPE(uniq d, name, category)
INGREDIENT(id, name) where id will be id of recipe(not uniq)

onion 2010-10-12 18:04

Re: Database structure
 
You should definitely study a bit about databases and database design before you start. It might first sound easy to work with just one or two tables but going with a properly normalized table design is the way to go.
The net is full of information about database basics, google is your friend. But here are some pointers to start with:
http://en.wikipedia.org/wiki/Database_normalization
http://dev.mysql.com/tech-resources/...alization.html

Lullen 2010-10-12 19:37

Re: Database structure
 
I'll start reading, thanks for the links!


All times are GMT. The time now is 10:42.

vBulletin® Version 3.8.8