Introduction to Databases

Database related concepts

  • Data independence: refers to the independence between the data structure of the application and the database.
  • Database (DB): DB is a collection of related data that is long-term stored in a computer, organized and managed in a unified manner.
  • Database Management System (DBMS): It is a layer of database management software located between the user and the operating system, which provides a method for users or applications to access the DB.
  • Database system (DBS): It is a system composed of computer hardware, software and data resources that can store a large amount of related data in an organized and dynamic manner and facilitate multi-user access, that is, it is a computer system using database technology.
  • Database technology: It is a software discipline that studies the structure, storage, design, management and use of databases.

data description

Data description goes through three stages: conceptual design, logical design, and physical design.

The term correspondence between conceptual design and logical design:

Concept Design logical design
Substance (objects that exist objectively and can be distinguished from each other are called entities ) Records (ordered collections of fields called records)
Attributes (an entity has many characteristics, a characteristic is called an attribute) Fields (named units that mark entity attributes)
Entity set (a collection of homogeneous entities of the same nature) file (a collection of records of the same type is called a file)
Entity identifier (a property or set of properties that uniquely identifies an entity) Key (a field or set of fields that uniquely identifies each record)

The data description in the physical design is: bit, byte, word, block, bucket, volume.

Description of the data link:

Association: is the relationship between entity keys. The number of entity sets associated with a connection becomes the arity of the connection. For example, there is a univariate relationship, a binary relationship, and a ternary relationship.

level of data abstraction

Four models are defined according to the data abstraction level: conceptual data model, logical data model, external data model and internal data model.

Conceptual model:

The global logical structure of data that expresses the viewpoint of user needs is called conceptual model. The conceptual model has the highest level of abstraction.

The conceptual model adopted now is mainly the entity relationship model (ER diagram). An ER diagram has three basic components:

  1. Rectangular box: used to identify the solid model (object under consideration);
  2. Diamond box: used to represent the connection model (connection between entities);
  3. Oval box: used to represent attributes of entity type and relation type.

Four characteristics of the conceptual model:

  1. Expresses the overall logical structure of the data;
  2. Model the data from the point of view of user needs;
  3. Independent of hardware and software;
  4. It is a tool for communication between database designers and users;

Logical Model:

A model of the DB global logical structure that expresses a computer-implemented viewpoint is called a logical model.

The logical model has the following characteristics:

  1. It expresses the overall logical structure of the DB, and is the designer's comprehensive description of the entire application project database.
  2. Model data from a database implementation point of view;
  3. Independent of hardware, but dependent on software (DBMS);
  4. It is a tool for communication between database designers and application programmers.

There are four main types of logical models: hierarchical, mesh, relational and object models.

project Hierarchical model mesh model relational model object model
founding 1968 1969 1970 1980s
data structure complex (tree structure) complex (directed graph structure) Simple (2D table) complex (nested, recursive)
data link by pointer by pointer through public properties between tables by object identification
query language procedural language procedural language non-procedural language object-oriented language
advantage Higher query efficiency compared to file systems M:N contact is easy to achieve high query efficiency Simple operation and simple data structure Have rich expressive ability
shortcoming

It can only represent the relationship of 1:N; the relationship between layers is complicated and the programming is complicated

Complex data structures and complex programming Complex problem domains are inferior to object models The m model is relatively complex and involves a lot of knowledge

External model:

The model of the local logical structure of the DB that expresses the user's usage point of view is called the external model.

The external model has the following characteristics:

  • is a subset of the logical model;
  • Independent of hardware, but dependent on software;
  • reflect the views of users using the database;

Advantages of external models:

  • Simplifies the user's point of view;
  • Contribute to the security maintenance of the database;
  • is the support for the conceptual model;

Internal model:

The model that expresses the physical structure of the DB is called the internal model.

The internal model, also known as the physical model, is the lowest-level abstraction of the database. It describes the storage method, access device and access method of data on disk or tape. Internal models are closely linked to hardware and software.

Three-level pattern and two-level abstraction

Three-tier schema architecture

From the user (or application) to the database, the data structure description of the DB has three levels:

  • The external mode is the interface between the user and the database system, and is the description of the part of the data used by the user;
  • The logical schema is the description of the overall logical structure of all the data in the database;
  • The internal schema is the description of the database in terms of physical storage.

The three-tier schema architecture has three characteristics:

  • Users use the DB's Data Manipulation Language (DML) statement to operate on the database, actually operating on the external records of the external schema. For example, when reading a record value, what is actually read is an external record value, not the internal record value of the database. With outer schemas, programmers don't have to care about logical schemas. In fact the outer schema is a logical subset of the logical schema.
  • The logical schema must not involve details such as storage structure, access technology, etc.
  • Intramode does not involve constraints on physical devices. Those software mechanisms that are closer to physical storage and access than inner mode are part of the operating system.

two-level image

  • External schema/logical schema image: exists between external schema and logical schema, and is used to define the correspondence between external schema and logical schema. This image is generally described in the outer schema.
  • Logical schema/intra schema mapping: exists between logical schemas and intra schemas, and is used to define the correspondence between logical schemas and intra schemas. This image is generally described in the inner schema.

High data independence

Data independence refers to the independence between the data structure of the application and the database. When modifying data structures, try not to modify the application as much as possible.

  • Physical data independence: If the internal schema of the database needs to be modified, that is, the physical structure of the database changes, as long as the logical schema/internal schema image is modified accordingly, the logical schema can be kept unchanged. Of course, the external schema and the application program are affected. smaller. This is called achieving physical independence.
  • Logical data independence: If the logical schema of the database needs to be modified, as long as the external schema/logical schema image is modified accordingly, the external schema and the application program can be kept as unchanged as possible, which is called logical independence.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325101889&siteId=291194637