Posts

Showing posts with the label data integrity

Data Integrity

Image
Introduction This is a term referring to the accuracy, completeness, consistency and reliability of data throughout its lifecycle, from when it is entered, stored, processed until it is deleted. Data with Integrity is data that correctly reflects objective reality and is not distorted, biased or contaminated due to system errors, human errors or hacker destruction. In database management systems like PostgreSQL, Data Integrity acts like strict rules, preventing any behavior that intentionally or unintentionally makes data absurd. To ensure data is always clean and correct, PostgreSQL provides the following core constraints: Entity Integrity When creating a table with a primary key, using a Unique Constraint or Unique Index means that the values in this column must be unique Ensures that the system can always distinguish between different entities, there is no such thing as two completely identical data rows or an "anonymous" data row existing. If you do not use the above meth...

Normalization and Denormalization

Image
Introduction Data Anomalies Before diving into the main content of this article, we need to understand Data Anomalies, which are logical flaws or data discrepancies that occur in relational databases when proper table normalization has not been applied. This leads to information being stored repeatedly in a redundant manner. When data operations (Insert, Update, Delete) are performed, they cause the database to fall into an inconsistent state where data is correct in some places but incorrect in others. Data Anomalies are divided into 3 main types: Insertion Anomaly: Occurs when you cannot add a new record into the database because the system forces you to enter another piece of information that does not yet exist. Deletion Anomaly: Occurs when you delete one piece of information but accidentally lose another completely different and important piece of information. Update Anomaly: Occurs when a piece of information is repeated across too many rows. As a result, when you edit that infor...