The "Three-Schema Architecture" is a framework used in database management systems (DBMS) to separate the user applications from the physical database. This separation ensures data independence, improves flexibility, and simplifies database design and maintenance. The architecture consists of three levels:
1. External Level (User Views)
-
Purpose: Represents the way users or applications view the data.
-
Description:
- This level describes the part of the database that is relevant to a particular user or group of users.
- Different users may have different views of the same data, depending on their needs.
- For example, a student view might include only course grades, while an instructor view might include grades and attendance records.
-
Key Features:
- Focuses on user-specific data requirements.
- Hides irrelevant or sensitive data from users.
- Provides a customized interface for different user groups.
2. Conceptual Level (Logical Schema)
-
Purpose: Represents the overall logical structure of the entire database.
-
Description:
- This level describes what data is stored in the database and the relationships between the data.
- It provides a global view of the database, independent of any specific user or application.
- For example, it defines entities like students, courses, and instructors, along with their attributes and relationships.
-
Key Features:
- Acts as a bridge between the external and internal levels.
- Ensures data consistency and integrity across the database.
- Hides the physical storage details from users and applications.
3. Internal Level (Physical Schema)
-
Purpose: Describes how the data is physically stored in the database.
-
Description:
- This level deals with the storage structures, file organization, indexing, and access methods used to store and retrieve data.
- It defines how the data is represented on disk, including details like data types, compression, and encryption.
- For example, it specifies whether a table is stored as a heap file or a B-tree index.
-
Key Features:
- Focuses on performance optimization and storage efficiency.
- Hides the physical details from the conceptual and external levels.
- Managed by database administrators (DBAs) and system developers.
Diagram of the Three-Schema Architecture
+-------------------+
| External Level | (User Views)
| - User-specific |
| views of data |
+-------------------+
^
| (Mapping)
+-------------------+
| Conceptual Level | (Logical Schema)
| - Global view of |
| the database |
+-------------------+
^
| (Mapping)
+-------------------+
| Internal Level | (Physical Schema)
| - Physical storage|
| details |
+-------------------+
Key Benefits of the Three-Schema Architecture
-
Data Independence:
- Logical Data Independence: Changes to the conceptual schema (e.g., adding a new table) do not affect the external views.
- Physical Data Independence: Changes to the internal schema (e.g., changing file structures) do not affect the conceptual or external levels.
-
Modularity:
- Each level can be modified independently, making the system more flexible and easier to maintain.
-
Security:
- Users only see the data they are authorized to access, as defined by the external views.
-
Simplified Design:
- Separating concerns (user views, logical structure, and physical storage) makes the database design process more manageable.
Example: Consider a university database:
-
External Level:
- A student sees their grades and course schedule.
- An instructor sees the list of students enrolled in their courses and their grades.
-
Conceptual Level:
- Defines entities like
Students
, Courses
, and Enrollments
, along with their attributes and relationships.
-
Internal Level:
- Specifies how the
Students
table is stored on disk, including file organization and indexing.
Conclusion
The Three-Schema Architecture is a foundational concept in database design that promotes data independence, security, and flexibility. By separating the user views, logical schema, and physical schema, it ensures that changes at one level do not disrupt the others, making the database system more robust and easier to manage.
Before moving on to the next lesson, click the link below to read more about database
three-schema architecture.
Three Schema Architecture
The next lesson introduces a special class of tools often used in database design.
[2]DML:DML (Data Manipulation Language) is a set of SQL commands used to manage and modify data within existing database tables, such as adding, removing, or changing records.