The three-level model and two-level mapping of the database--a brief introduction

Visually explain the three-level model and two-level mapping of the database

The three-level model and two-level mapping of the database are standardized recommendations made by the database management system research group of the American National Standard Institute (ANSI) in 1978, and the database structure is divided into three levels: user-oriented or application-oriented User level for personnel, conceptual level for building and maintaining databases, and physical level for system programmers. The two-level mapping connects channels of three different modes

Three-level model concept map

Insert picture description here

Suppose there is a student information database.

Internal Schema (physical level)

It can be seen from the conceptual diagram that the internal mode is the closest to the hardware. In fact, the internal mode is a description of the physical structure and storage method of the data . It has been determined at the beginning of the database creation and determines how the data is stored on the hard disk. Where is the data stored on the hard disk. For example, on which hard disk the student’s information is stored, in binary or text mode. This belongs to the internal mode

Conceptual Schema (conceptual level)

Also known as the logical mode, the conceptual mode is equivalent to a buffer between the outer mode and the inner mode. It is a description of the logical structure and characteristics of all data . It determines which fields are in a table, and what is between the table and the table Relationship. For example: in the student information database, which fields are in the student table, which field is the primary key, and what is the relationship between the student table and the teacher table. This is the conceptual model

External mode (user level)

The external mode is user-oriented, and the external mode is the partial data and logic presented in response to user needs . There are multiple . It determines what content certain specific users can see. For example: in the student information system In the face of student users, the database displays almost all the data and logic about the students themselves. But for ordinary teacher users, they can only see the results of the students in the subjects they teach. For the dean of academic affairs, they can see almost all the students. All the results. The different data and logic that each user sees are different external patterns.

Two-level mapping

In fact, it is very simple.The database is divided into three levels, so a two-level image is provided.

  • Mode/Internal Mode: Realize the mutual conversion between conceptual mode and internal mode
  • The image of the outer model/pattern: realize the mutual conversion between the outer model and the conceptual model

Benefits of using three-level mode and two-level mapping

Achieve physical and logical independence of data

  • Data physical independence : Because when the internal schema of the database changes, the logical model does not change.
  • Logic independence : When the data logic changes, the application does not need to change, because the application only cares about the outer mode (view).

Guess you like

Origin blog.csdn.net/qq_44823898/article/details/108799642