Data-Isolation-and-Integrity¶
1. Data Isolation (āĻĄā§āĻāĻž āĻŦāĻŋāĻā§āĻāĻŋāύā§āύāϤāĻž)¶
Data Isolation refers to a situation where related pieces of information are scattered (āĻāĻĄāĻŧāĻŋāϝāĻŧā§-āĻāĻŋāĻāĻŋāϝāĻŧā§ āĻĨāĻžāĻāĻž) across multiple files, stored in different formats (āĻŦāĻŋāύā§āϝāĻžāϏ), or partitioned (āĻŦāĻŋāĻāĻā§āϤ) across different departments.
- The Problem (āϏāĻŽāϏā§āϝāĻž):
- In traditional file-processing systems, because data files are created by different programmers at different times using different applications (e.g.,
.txt,.csv,.xlsx), the data becomes isolated (āĻŦāĻŋāĻā§āĻāĻŋāύā§āύ/āĻāϞāĻžāĻĻāĻž). -
Writing new code to extract, merge (āĻāĻāϤā§āϰāĻŋāϤ āĻāϰāĻž), and cross-reference (āĻĒāĻžāϰāϏā§āĻĒāϰāĻŋāĻ āϏāĻŽāύā§āĻŦāϝāĻŧ āĻāϰāĻž) this scattered information requires extensive custom programming and is error-prone.
-
Real-World Example (āĻŦāĻžāϏā§āϤāĻŦ āĻāĻĻāĻžāĻšāϰāĻŖ):
- The Sales department records monthly sales in an Excel sheet (
sales.xlsx). - The Customer Support team logs client complaints in a plain text file (
support.txt). -
If management asks for a list of "Customers who filed complaints and bought products this month," there is no direct link between the two files. A developer must write a dedicated translation program to parse (āĻŦāĻŋāĻļā§āϞā§āώāĻŖ āĻāϰāĻž) and join both file structures manually.
-
DBMS Solution (āϏāĻŽāĻžāϧāĻžāύ):
- A relational database centralizes (āĻāĻāϤā§āϰāĻŋāϤ āĻāϰā§) all tables in a single structured schema, allowing users to connect related data instantly using SQL
JOINoperations.
2. Data Integrity (āĻĄā§āĻāĻžāϰ āύāĻŋāϰā§āĻā§āϞāϤāĻž āĻ āύāĻŋāϰā§āĻāϰāϝā§āĻā§āϝāϤāĻž)¶
Data Integrity refers to the overall accuracy (āύāĻŋāϰā§āĻā§āϞāϤāĻž), completeness (āĻĒā§āϰā§āĻŖāϤāĻž), and reliability (āύāĻŋāϰā§āĻāϰāϝā§āĻā§āϝāϤāĻž) of data throughout its lifecycle. It ensures that the data stored in the database adheres strictly to real-world business rules and remains free from corruption (āĻŦāĻŋāĻā§āϤāĻŋ/āϤā§āϰā§āĻāĻŋ).
- The Problem in File Systems (āĻĢāĻžāĻāϞ āϏāĻŋāϏā§āĻā§āĻŽā§āϰ āϏāĻŽāϏā§āϝāĻž):
- File systems cannot enforce business rules directly on the stored data.
-
Rules have to be hardcoded into the application software's source code. If multiple applications write to the same files, one buggy program can easily insert invalid values.
-
Integrity Constraints in DBMS (āĻĄāĻŋāĻŦāĻŋāĻāĻŽāĻāϏ-āĻ āĻļāϰā§āϤāĻžāĻŦāϞā§):
- Domain Integrity (āĻĄā§āĻŽā§āύ āĻļāϰā§āϤ): Ensures every entry in a column is valid according to its defined type and range.
-
Example: An
Agefield accepts only positive integers (Age > 0), or aPhone_Numbercolumn accepts only numbers. -
Entity Integrity (āϏāϤā§āϤāĻž āĻļāϰā§āϤ): Guarantees that every record can be uniquely distinguished (āϏā§āĻŦāϤāύā§āϤā§āϰāĻāĻžāĻŦā§ āĻļāύāĻžāĻā§āϤ āĻāϰāĻž).
-
Rule: A
PRIMARY KEYcolumn must hold unique values and cannot be empty (NOT NULL). -
Referential Integrity (āϰā§āĻĢāĻžāϰā§āύā§āϏāĻŋā§āĻžāϞ/āϏāĻŽā§āĻĒāϰā§āĻāĻāϤ āĻļāϰā§āϤ): Preserves valid relationships across connected tables using
FOREIGN KEYconstraints. -
Rule: If an
Orderstable listsCustomerID = 205, that customer must actually exist in the parentCustomerstable. -
User-Defined Integrity (āĻŦā§āϝāĻŦāĻšāĻžāϰāĻāĻžāϰā§-āϏāĻāĻā§āĻāĻžāϝāĻŧāĻŋāϤ āĻļāϰā§āϤ): Specific business logic added to meet organizational policies.
- Example: A banking rule enforcing
CHECK (Account_Balance >= 500).
Summary Comparison¶
| Concept (āϧāĻžāϰāĻŖāĻž) | Core Meaning (āĻŽā§āϞ āĻ āϰā§āĻĨ) | File System Limitation (āĻĢāĻžāĻāϞ āϏāĻŋāϏā§āĻā§āĻŽā§āϰ āϏā§āĻŽāĻžāĻŦāĻĻā§āϧāϤāĻž) | DBMS Solution (āĻĄāĻŋāĻŦāĻŋāĻāĻŽāĻāϏ-āĻāϰ āϏāĻŽāĻžāϧāĻžāύ) |
|---|---|---|---|
| Data Isolation | Data is fragmented (āĻāĻŖā§āĻĄāĻŦāĻŋāĻāĻŖā§āĻĄ) across different files and formats. | Difficult to merge and query data from separate departmental files. | Stores tables in a unified database accessible via relational queries (JOIN). |
| Data Integrity | Data must remain accurate, valid, and consistent (āϏāĻžāĻŽāĻā§āĻāϏā§āϝāĻĒā§āϰā§āĻŖ). | Rules must be hardcoded inside application programs; easily bypassed or broken. | Enforces rules directly on the database engine using declarative constraints (PRIMARY KEY, FOREIGN KEY, CHECK). |