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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.