Data Abstraction
Data Abstraction
Definition
Data Abstraction is the general principle underlying the entire three-schema architecture: hiding details that are not relevant at a given level, and showing each audience only what it needs. The three abstraction levels are the physical level (lowest, most detail), the logical level (moderate detail, overall structure), and the view level (highest, least detail, closest to the end user).
How It Works — One Value, Three Levels of Detail
Consider a bank account balance.
- View level (most abstract): a customer's mobile app shows only
Account Number, Balance— nothing about how it is computed or stored. - Logical level (moderate detail): the bank's conceptual schema defines
Account(AccNo, Balance, CustomerID, BranchID, InterestRate)with constraints such asBalance >= MinimumBalance. - Physical level (most detail): records may actually be stored as fixed 128-byte blocks, hashed by
AccNoand sharded across several physical database servers, with a write-ahead log tracking every balance change.
Each level deliberately hides information irrelevant to that audience: the customer does not need to know about sharding, and even the logical schema does not need to expose the write-ahead log.
Relationship to the Three Schema Architecture
Data abstraction is the principle; the three-schema architecture (2.1) is the concrete framework built directly on top of it. Each of the three schema levels — external, conceptual, internal — is simply one application of data abstraction to database design: external = view-level abstraction, conceptual = logical-level abstraction, internal = physical-level abstraction.
Edge Cases and Pitfalls
- Abstraction leaking through: if a view-level screen shows a raw internal error code or a physical storage detail (like a shard ID) to an end user, the abstraction has failed — it defeats the purpose of hiding irrelevant complexity.
- Over-abstracting can also cause real problems: hiding whether a stored value is
NULLversus0at the view level, for instance, can mislead users into misinterpreting missing data as an actual zero balance.
Interview Takeaways
- Q: How does data abstraction relate to the three-schema architecture? The three schema levels are a direct, concrete application of the general data abstraction principle — each level abstracts away detail irrelevant to its intended audience.
- Q: Name the three levels of data abstraction from most to least detailed. Physical (most detail) → Logical → View (least detail, most abstract).