Updating data in relational database, without affecting the already existing relation -
how database systems create changes in relational info contains partial history? example, in contract management system, have maintenance contract company maintain products. these products linked maintenance contract (within database). assume have maintained these products on 2 years within contract, , product changes in attributes, need alter info product. if that, because of relation contracts, info tell me maintained product in it's changed attributes, on 2 years, not true!
now assume have simple contracts , products relationship (m:m relationsip, contracts_products junction table needed) , productattributes, in relationship products (m:1 relationship). since not alter contract, neither product, productattributes, possible solutions maintain relationship past same, while changing productattribute upcoming time?
as understand requirements, need separate properties of product alter on time (e.g., supplier, operating temperature range, unit cost) invariant (e.g., description, color, weight).
call table holds invariant properties productfixedattributes
, 1 holds changeable properties productvariableattributes
. row of current products
table 1-to-1 productvariableattributes
, many-to-1 productfixedattributes
, , can drop productattributes
table.
when product's properties change, add together new row products
points new row in productvariableattributes
, existing row in productfixedattributes
. utilize new row future associations new contracts
; not alter existing rows in contracts_products
.
database-design relational-database
No comments:
Post a Comment