Qbasicnews.com

Full Version: mySQL Recipe Database
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hi everyone,

Haven't posted here in a bit, but I'm trying to figure out how to do something in mySQL, and I don't know what the correct approach is.

Basically, I'm looking to make a database for storing recipes. Obviously, the straightforward method is to just copy my blog code and change 'blogtext' to 'recipetext' -- but I'd like to chop it up into a few more fields than that... prep time, notes, instructions, description, picture, etc...

And then there's the ingredients. As I see it, they should be a table within the larger table so that in the future, a query could be done looking for 'all recipes containing tomatoes' or something like that without resorting to a text-search.

Anyhow, even if I'm making this a whole lot more complicated than it needs to be, I'd like to learn how to set up a relationship like this in SQL.

In brief: How can a record in a table contain links to an uncertain number of records in another table? Even better, could I say that bread contains water, flour, oil, salt, and yeast in these quantities, whereas muffins contain the same things in different quantities?

Thanks for any help.

Mike

EDIT: Okay, I'm doing it with three tables: Recipes, Ingredients, and Intersections, where the intersection table contains a record with the IDs of each instance of an ingredient in a recipe... additional benefit: it can contain the quantity! So I've got that part sorted out, but if anyone has any suggestions to put forward, I'd love to hear them.
Hmm... try making a table called 'ingredients' with a table column. And then perform two queries, one for the recipe, one for the ingredients. That's the only way I could think of doing it.

Really, I'd just do a text search.
well, have fun competing with this monster.
Quote:well, have fun competing with this monster.

Heh... holey cow... I saw the BBC UK recipe site, but that one's enormous.

Anyhow, the business of isolating ingredients from recipes is something that I haven't seen anywhere else. It may not work, but I think it's nifty.

At any rate, the whole project is more for learning than an attempt to actually create something useful on a large scale.

(although I'll be getting my mom and sisters to submit things to it for me to eat at university...)
Recipes is the least of my concerns at school -- I need someone to buy food and cook it for me Smile
If you had $10 and in front of you was a cookbook store and to the right of that a raw food store (If you eat something there you will die of food poisoning if no cooked)

You notice the cookbooks are $10. What do you do? surely you will die if you dont buy food and you will die if you dont eat it properly.

The answer is simple. Ask for the directions to a fast food resturant.

Anyway...

I am definatly going to show my mom that site =P
Quote:If you had $10 and in front of you was a cookbook store and to the right of that a raw food store (If you eat something there you will die of food poisoning if no cooked)

You notice the cookbooks are $10. What do you do? surely you will die if you dont buy food and you will die if you dont eat it properly.
or you could cook it until you think its at least not all red in the middle. you may be eating a blackened piece of meat, but its not poisoned. that, or you can just go buy some lunchables. who lives on their own, but doesnt know how to make cereal anyway? or who doesnt know where fast food is?

my mom lredy knew of tht site. nywys, my brother mde simple recipe progrm nd he knew it wouldnt be better thn tht, but he did it nywys. so ye...

no 's!!!
Quote:Recipes is the least of my concerns at school -- I need someone to buy food and cook it for me Smile

...as well as keep you warm on cold nights...However, this can lead to commitments and other complications.

BEWARE
IMO, anyone who doesn't have at least some basic cooking skills in this day and age has got some issues. Big Grin Jofers, I hope you can at least hard-boil an egg? Big Grin Or at the absolute worst...boil water? Big Grin
Quote:or you could cook it until you think its at least not all red in the middle. you may be eating a blackened piece of meat, but its not poisoned. that, or you can just go buy some lunchables. who lives on their own, but doesnt know how to make cereal anyway? or who doesnt know where fast food is?

im pretty sure i said it's poisoned if you sont eat it properly. I dont think making it all blackish counts -_-
Pages: 1 2 3