Active Topics

 


Reply
Thread Tools
Posts: 289 | Thanked: 101 times | Joined on Oct 2009
#1
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,
 
Posts: 180 | Thanked: 76 times | Joined on May 2010
#2
Maybe you can use three tables:

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

The Following User Says Thank You to Diph For This Useful Post:
bonapart's Avatar
Posts: 565 | Thanked: 816 times | Joined on Sep 2010 @ Nevinnomyssk
#3
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)
 

The Following User Says Thank You to bonapart For This Useful Post:
Posts: 96 | Thanked: 105 times | Joined on Aug 2006 @ Finland
#4
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
__________________
--
2x770, N810 and 2xN900, N950, 2xN9, BBZ10
Devel - twitter - blog
 

The Following User Says Thank You to onion For This Useful Post:
Posts: 289 | Thanked: 101 times | Joined on Oct 2009
#5
I'll start reading, thanks for the links!
 
Reply


 
Forum Jump


All times are GMT. The time now is 09:12.