Jump to content

Recipes Database


dropfaith

Recommended Posts

what would the best way to set this up be

 

im thinking two tables one for the name of what your making, about, cook time, all that then a second for ingredients

with just an Id and the Ingredient name

 

but the issue im imagining is being able to insert multiple rows into ingredients in one query?

Link to comment
https://forums.phpfreaks.com/topic/128068-recipes-database/
Share on other sites

I made a recipe database for myself, this is what mine looks like...

 

create table food_category (
    category_id int not null primary key,
    name text not null
)

go

create table food_recipe (
    recipe_id int not null primary key,
    name text not null,
    category_id int not null
        REFERENCES food_category (category_id)
)

go

create table food_ingredient (
    ingredient_id int not null primary key,
    ingredient_name text not null
)

go

create table food_quantity_type (
    quantity_type_id int not null,
    quantity_name text not null
)

go

create table food_recipe_ingredient (
    recipe_id int not null
         REFERENCES food_recipe(recipe_id),
    ingredient_id int not null
         REFERENCES food_ingredient(ingredient_id),
    quantity int not null,
    quantity_type_id int not null
         REFERENCES food_quantity_type(quantity_type_id)
)

go
create table food_recipe_tags (
    recipe_id int not null
         REFERENCES food_recipe(recipe_id),
    tag text not null
)

 

 

Link to comment
https://forums.phpfreaks.com/topic/128068-recipes-database/#findComment-663450
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.