Three-level model of the database system
External mode
The external mode is also called sub-mode or user mode, which corresponds to the user level. It is a data view of a database that one or several users see, and is a logical representation of the data associated with an application. The outer mode is a subset of the export from the schema that contains the portion of data that is allowed to be used by a particular user in the pattern. The user can describe, define the data record (external mode) corresponding to the user through the external mode description language, or use the data manipulation language,dml to make the data records. The external model reflects the user view of the database.
Mode
A pattern is also called a conceptual or logical pattern, which corresponds to a conceptual level. It is by the Database Designer synthesizes all user's data, constructs the global logical structure according to the unified viewpoint, is the entire data in the database logical structure and the characteristic general description, is all user's public Data View (global view). It is described and defined by data Description LANGUAGE,DDL, which is provided by database management system, and reflects the whole view of database system.
Internal mode
Internal mode, also known as the storage mode, corresponds to the physical level, which is the internal representation or the underlying description of all data in the database, is the logical description of the lowest level of the database, it describes how the data is stored on the storage medium and the physical structure, corresponding to the actual storage on the external storage media database. The inner mode is described and defined by the internal Schema description language. Two-level image and data independence for the database
1. External mode/mode image
When the pattern changes (such as adding new relationships, new attributes, changing the data type of the attribute, etc.), the database administrator changes the image of each external mode/pattern so that the external mode remains unchanged. The application is written according to the external mode of the data, so that the application does not have to be modified, which guarantees the logical independence of the data and the program.
2. Mode/Internal mode image
There is only one pattern in the database, and there is only one inner mode, so the pattern/inner mode image is unique, it defines the correspondence between the global logical structure of the database and the storage structure, which is usually contained in the definition description of the conceptual schema.
When the internal schema storage structure of the database has changed (such as selecting another storage structure), the database administrator changes the pattern/internal mode image so that the pattern remains unchanged so that the application does not have to be changed, which guarantees the physical independence of the data and the program, or the physical independence of the data.
In the three-level schema structure of the database, the database schema, the global logical structure, is the center and key of the database, which is independent of the other layers of the database. Therefore, when designing a database schema, you should first determine the logical schema of the database.
The internal schema of the database relies on its global logical structure, but is independent of the database's external schema and the specific storage device. It is the data structure defined in the global logical structure and its relations are organized according to a certain physical storage strategy, in order to achieve better time and space efficiency.
The external schema of the database is for a specific application, which is defined on the logical mode, but independent of the internal mode and storage device. When the application requirements change greatly, the corresponding external mode can not meet its view requirements, the external mode needs to be modified accordingly, so the design of the external mode should take into account the extensibility of the application. Different applications can sometimes share the same out-of-the-way mode.
The two-level image of the database guarantees the stability of the out-of-database model, guaranteeing the stability of the application from the bottom up, unless the application requirements themselves change, otherwise the application generally does not need to be modified.
The three-level and two-level images of the database implement the independence between the data and the program, so that the definition and description of the data can be separated from the application. In addition, because data access is managed by the DBMS, users do not have to consider details such as access paths, which simplifies application development and greatly reduces application maintenance and modification costs.
Principle of database-structure of database system