I normally have a monolithic table for recipes so it's easy to insert it into the database in one statement as below:
INSERT INTO Recipes(Version, Owner, Title, Categories, Serves, Source, Ingredients, Instructions, PictureName, LastUpdate, Favourite, Deleted) VALUES('" + Version$ + "','" + Owner$ + "','" + Title$ + "','" + Categories$ + "','" + Serve$ + "','" + Source$ + "','" + Ingredient$ + "','" + InStruction$ + "','" + PictureName$ + "','" + LaStUpdate + "','" + Favourite$ + "','" + "0"
But, I want to 'normalise' my database as below to be more flexible, save space, redundancies etc. Rather than normalising an existing database, I will start from scratch using the same form to gather the data (Ingredients, instructions and categories are lists) but I don't know how to make a complex/compound insert query to take care of all the relationships for the linked tables etc.
Can anyone point me in the right direction? I am new at this 'normalisation' strategy.
recipes table recipe_id recipe_name recipe_version recipe_owner recipe_author recipe_source recipe_copyright recipe_lastupdate recipe_favourite recipe_deleted recipe_description recipe_notes recipe_servings recipe_peparationtime recipe_cookingtime recipe_totaltime
ingredients table ingredient_id ingredient_name ingredient_price
recipe_ingredients table recipe_id ingredient_id ingredient_amount
recipe_instructions table recipe_id recipe_step step_description
category table category_id category_name
recipe_category table recipe_id category_id
picture table picture_id picture_name picture_url
recipe_pictures table recipe_id picture_id
Aucun commentaire:
Enregistrer un commentaire