BIT202 ยท 2082 ยท 5 marks
Describe the three schema architecture. How does the architecture create data independence?
Describe the three schema architecture. How does the architecture create data independence? [5]
Quick answer
The three schema architecture (also called the ANSI/SPARC architecture) is a framework for database systems that separates the database into three distinct levels or schemas. This architecture was proposed to achieve data independence and support multiple user views.
Three Schema Architecture and Data Independence
Three Schema Architecture
The Three Levels
1. External Level (View Level)
- The highest level of abstraction, closest to the end users.
- Describes how individual users or groups of users see the data.
- Each user group has its own external schema (user view), showing only the portion of the database relevant to that user.
- Different users can have different views of the same data.
- Example: A student may see only their own grades, while a teacher sees all student grades.
2. Conceptual Level (Logical Level)
- The middle level, representing the community or organizational view of the entire database.
- Described by a conceptual schema, which defines:
- All entities, attributes, and relationships
- Constraints, security, and integrity rules
- Hides the physical storage details but describes what data is stored and how it is logically structured.
- Managed by the Database Administrator (DBA).
3. Internal Level (Physical Level)
- The lowest level, closest to physical storage.
- Described by an internal schema, which defines:
- How data is physically stored on disk
- File organization, indexing, hashing, access paths
- Storage allocation and compression
- Deals with the actual implementation of the database.
Diagram
+-----------------------------+
| External Schema 1 | External Schema 2 | ... | <- External Level
+-----------------------------+
|
+-----------------------------+
| Conceptual Schema | <- Conceptual Level
+-----------------------------+
|
+-----------------------------+
| Internal Schema | <- Internal Level
+-----------------------------+
|
+-----------------------------+
| Physical Database |
+-----------------------------+
How the Architecture Creates Data Independence
Data independence is the ability to change the schema at one level without having to change the schema at the next higher level. The three schema architecture achieves this through two types of mappings:
1. Logical Data Independence
- The ability to change the conceptual schema without changing the external schemas or application programs.
- Example: Adding a new attribute (column) to a table, or splitting a table, does not affect the user views as long as the mapping between external and conceptual levels is updated.
- This is harder to achieve in practice.
2. Physical Data Independence
- The ability to change the internal schema without changing the conceptual schema.
- Example: Changing the file organization from sequential to indexed, or moving data to a different storage device, does not affect the logical structure.
- This is easier to achieve and is supported by most DBMS.
Summary Table
| Change Made At | Does Not Affect | Type of Independence |
|---|---|---|
| Internal Schema | Conceptual Schema | Physical Data Independence |
| Conceptual Schema | External Schema | Logical Data Independence |
Conclusion
The three schema architecture creates data independence by introducing clear separation between how data is physically stored, how it is logically organized, and how it is viewed by users. The mappings between levels ensure that changes at one level are translated appropriately, shielding higher levels from lower-level changes. This reduces maintenance cost, improves flexibility, and allows the database to evolve without disrupting existing applications.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.