The division of the database's three-level schema architecture is conducive to maintaining the "data independence" of the database. The three-level database schema includes external schema, schema, and internal schema; the two-level images of the three-level schema are the image of the external schema/mode and the image of the schema/internal schema. The image of the external mode/mode ensures logical independence, and the image of the mode/inner mode ensures physical independence.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
The division of the three-level schema architecture of the database is conducive to maintaining the "data independence" of the database.
Three-level database schema architecture
People have designed a rigorous architecture for the database, a standard structure recognized in the database field It is a three-level schema structure, which includes external schema, conceptual schema, and internal schema, which effectively organizes and manages data and improves the logical independence and physical independence of the database. The user level corresponds to the external schema, the conceptual level corresponds to the conceptual schema, and the physical level corresponds to the internal schema, allowing users at different levels to form different views of the database. The so-called view refers to the scope, angle and method of observing, understanding and understanding data. It is the reflection of the database in the "eyes" of the user. Obviously, the database "seen" by users at different levels (levels) is different.
External mode
External mode is also called submode or user mode, corresponding to the user level. It is a data view of the database seen by one or several users, and is a logical representation of data related to a certain application. The foreign schema is a subset derived from the schema and contains that portion of the data in the schema that is allowed to be used by a specific user. Users can describe and define data records corresponding to users (external schemas) through external schema description languages, and they can also use data manipulation language (Data Manipulation Language, DML) to operate on these data records. The external schema reflects the user's view of the database system.
Conceptual pattern
Conceptual pattern is also called pattern or logical pattern, corresponding to the concept level. It is a global logical structure constructed by the database designer based on a unified point of view, integrating the data of all users. It is an overall description of the logical structure and characteristics of all data in the database, and is a common data view (global view) for all users. It is described and defined by the Data Description Language (DDL) provided by the database management system. Conceptual schema reflects the overall view of the database system.
Internal mode
Internal mode is also called storage mode and corresponds to the physical level. It is the internal representation or underlying description of all data in the database, and is the lowest level logical description of the database. It describes the storage method and physical structure of the data on the storage medium, and corresponds to the database actually stored on the external storage medium. Internal patterns are described and defined by internal pattern description languages. The internal schema reflects the storage view of the database system.
Two-level mapping
In order to achieve the connection and conversion between these three abstract levels, the database The management system provides two levels of mapping in the three-level mode, namely external mode/mode mapping and mode/internal mode mapping.
1. Foreign mode/mode mapping
There can be any number of foreign modes for the same mode. For each foreign schema, the database system has a foreign schema/schema mapping. When the schema is changed, the database administrator makes corresponding changes to each foreign schema/schema mapping so that the foreign schema remains unchanged. In this way, applications written based on data external schema do not need to be modified, ensuring the logical independence of data and programs.
Summary: External schema/schema mapping ensures that when the schema changes, the external schema does not change, that is, logical independence.
2. Schema/inner schema mapping
There is only one schema and one inner schema in the database, so the schema/inner schema mapping is unique, and it defines the database The correspondence between the global logical structure and the storage structure. When the storage structure of the database is changed, the database administrator makes corresponding changes to the schema/internal schema mapping so that the schema remains unchanged and the application does not change accordingly. In this way, the physical independence of data and programs is ensured.
Summary: Mode/inner mode mapping ensures that when the inner mode changes, the mode does not change, that is, physical independence.
Two-layer mapping is only at the system design level, ensuring the stability of its underlying mode (foundation) in each mode. Two-layer mapping is only a guarantee at the system theoretical design level. If your application requirements themselves change, everything may need to be changed.
Recommended tutorial: mysql video tutorial
The above is the detailed content of The division of the three-level schema architecture of the database is conducive to maintaining what the database. For more information, please follow other related articles on the PHP Chinese website!