Managing Computed Attributes
Learn how storing derived fields in databases poses integrity and redundancy challenges.
We'll cover the following...
We'll cover the following...
Challenges of storing derived fields
SalesAmount, are generally not stored in the database because they can always be computed from the base information. Storing such fields in a database can lead to several issues such as data integrity, redundancy, and more.
Data integrity
There’s a risk of inconsistencies if the base data changes, but the derived fields aren’t updated accordingly. This can lead to inaccurate information.
To identify potential inconsistencies, let’s write a query to examine values where the derived amount (SalesAmount) does not match the actual amount.