Planning new database (1 Viewer)

Mina Garas Daniel

Registered User.
Local time
Today, 16:31
Joined
Jul 21, 2017
Messages
66
Hi everybody
I'm trying to planning new database based on food recipes
so i need to though with all of u about this database

i divide tables to
tbl1ItemData: ItemPK, Item Name, Item description, Client
tbl2RecipeIngredients: ItemFK, Ingredients, Brand, Unit, Qty
tbl3RecipeSteps: ItemFk, Categories, Steps

i will join ItemPK to each ItemFK in another tables to join item name with recipe ingredient and recipe steps

that means i have 1 Primary key and 2 foreign keys and may be become 3 or 4 FK if i want

the problem here that i want to discus with all of u sometimes i need to update one part only from data base not all
as an instance :
tbl1: ItemPK = 1 , item name = Mushroom soup
tbl2: ItemFK = 1 , Ingredients = Mushroom
tbl3: ItemFK = 1 , Categories = Dry mushroom

this called recipe 1 for Mushroom soup
now i need to make update in tbl3 only (as an instance: Categories = sliced mushroom) but in same time i need to keep data in tbl2 and tbl1
how can i do that without repeat all data again with new ItemPK???

Can anybody help??!

Thanks
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:31
Joined
Feb 28, 2001
Messages
27,133
If the table to be updated has foreign keys to support the selection, you can write an UPDATE statement in SQL that includes the WHERE clause that selects the specific entry and does a SET for only one of the fields. Nothing in tables 1 or 2 would be altered.
 

Users who are viewing this thread

Top Bottom