when I design a database for production, I got a problem. I have 5 table's Product, SemiProduct, BOOM,BOOM_Details,Material.
Product(Code,Name,BOOM_Code,etc....)
SemiProduct(Code,Name,BOOM_Code,etc...)
BOOM(BOOM_Code,etc...)
BOOM_Details(ID,BOOM_Code,Component, Percent)
Material(Code,Name, etc..)
My data for each table is :
Product
{Pro1,Product1, BOOMPRO1}
{Pro2,Product2, BOOMPRO2}
-----------
SemiProduct
{SemiPro1,Semi Product1, BOOMSemi1}
{SemiPro2,Semi Product2, BOOMSemi2}
------------
BOOM
{BOOMPRO1}
{BOOMPRO2}
{BOOMSemi1}
{BOOMSemi2}
----------
Material
{M1,Material1}
{M2,Material12}
---------------
BOOM_Details
{1,BOOMPRO1,M1, 20}
{2,BOOMPRO1,M2, 25}
{3,BOOMPRO1,SemiPro1, 25}
{4,BOOMPRO1,SemiPro2, 30}
{5,BOOMPRO2,M1, 20}
{6,BOOMPRO2,M2, 25}
{7,BOOMPRO2,SemiPro1, 55}
The problem is col [Component] in [BOOM_Details]. It can be code of Material or Code of SemiProduct. Please help me create FOREIGN KEY from Component REFERENCES to [Material].[Code] and [SemiProduct].[Code] Or show me a different way to design the table with data like that.
Thank you very much !