I have a table design doubt.
First table called products_mast contains
CONTRACTS_ID (PK),
AGREEMENT_NO,
SUPPLIER_CODE,
START_DATE,
END_DATE
PROD_EXTENSION_NO
Second table called products_det contains
HIRING_ID (PK),
CONTRACTS_ID(FK),
PRODUCT_CODE,
RATE
The above tables are linked with CONTRACTS_ID. Start Dates and End Dates are in one table and product rates in second table.
In my third table TRANSACTIONS contains,
TRANS_ID,
TRANS_REF_NO,
HIRING_ID FK (products_det),
REMARKS
One issue is normally the agreement_no can get extended for a period with new product rates for the extended agreement. So I add those details in
products_mast and products_det with same agreement no with extension 002 (for new extension). In TRANSACTIONS how can I refer to correct
rates if I am linking HIRING_ID with products_det because HIRING_ID gets incremented with new extension. How can I resolve this issue?
I’m not quite sure I follow exactly what you are suggesting regards agreement no value of extension 002 (new extension) however if it’s a case of uniquely identifying the transaction per agreement no, what about adding a FK to the table Transactions linking it back to the AGREEMENT_NO field in the products_mast table?