Database system overview study notes-introduction

introduction

1. Overview of the database system

1.1. 4 basic concepts of database

  1. data

    Data is the basic object stored in the database.

  2. Database (DB)

    A database is a collection of large amounts of data stored in a computer for a long time, organized and shared . The data in the database is organized, described and stored according to a certain data model, with less redundancy, higher data independence and easy expansion, and can be shared by various users.

  3. Database Management System (DBMS)

    The database management system is a layer of data management software between the user and the operating system. The database management software is the basic software of the computer like the operating system, that is, the system software . It completes the scientific organization and storage of data, and efficiently obtains and maintains data. Its main functions are as follows:

    • Data definition function

      The user can easily define the composition and structure of the data objects in the database through DDL.

    • Data organization, storage and management

    • Data manipulation function

      DML, add, delete, modify and check

    • Database transaction management and operation management

    • Database establishment and maintenance function

    • Other functions

  4. Database System (DBS)

    A database system is a system for storing, managing, processing and maintaining data composed of databases, database management systems (and their development tools), applications and database administrators (DBA) .

Insert picture description here


2. Data model

The data model is also a model, which is an abstraction of the characteristics of real world data . In other words, the data model is used to describe data, organize data, and operate on data. The data model is the core and foundation of the database system .

1.2.1, two types of data models

According to the different purposes of the model application, these models can be divided into two categories, which belong to two different levels . The first category is conceptual models, and the second category is logical models and physical models.

  • The first category is: conceptual model

    Also known as information model, it is based on the user's point of view to model data and information , mainly used for database design .

  • The second category is: logical model and physical model

    The logical model is mainly divided into:

    • Hierarchical model

    • Mesh model

    • Relational model

    • Object-oriented data model

    • Object Relational Data Model

    • Semi-structured model

      It is based on the computer system's point of view to model data , mainly used for the realization of database management systems .

    The physical model is an abstraction of the lowest level of data. It describes the representation and access methods of data in the system, or the storage and access methods on disks or tapes, and is computer-oriented.

Insert picture description here

1.2.1.1. Conceptual model
  • Some basic concepts in the information world

    1. entity

    2. Attributes

    3. code

      The set of attributes that uniquely identify an entity is called a code.

    4. Physical

      Entities with the same attributes must have common characteristics and properties. The entity name and its attribute name set are used to abstract and portray similar entities, which is called entity type . For example, the student (student number, name, gender, date of birth, school department, enrollment time) is an entity type.

    5. Entity set

      A collection of entities of the same type is called an entity set . For example: all students is an entity set.

    6. contact

      The connection between entities usually refers to the connection between different sets of entities. There are many types of connections, such as one-to-one, one-to-many, and many-to-many.

  • A representation method of conceptual model: entity-connection method

    The entity-connection method uses the ER diagram to describe the conceptual model of the real world. The ER method is also called the ER model .

1.2.1.2 The components of the data model

The data model usually consists of three parts: data structure, data operation and integrity constraints .

  1. data structure

    The data structure describes the constituent objects of the database and the connections between the objects . In other words, there are two types of content described by the data structure: one is related to the type, content, and nature of the object; the other is related to the connection between data. In short, a data structure is a collection of object types described, and it is a description of the static characteristics of the system .

  2. Data manipulation

    Data operation refers to the set of operations allowed to be performed on the instances (values) of various objects (types) in the database , including operations and related operating rules. It is a description of the dynamic characteristics of the system .

  3. Data integrity constraints,

    Data integrity constraints are a set of integrity rules . Integrity rules are the constraints and dependency rules of the data and its connections in a given data model, which are used to limit the database status and status changes that conform to the data model to ensure that the data is correct, valid and compatible.

1.2.2, relational model

1.2.2.1, the data structure of the relational model

From the user's point of view, the relationship model is composed of a set of relationships . The data structure of each relationship is a normalized two-dimensional table . Here are some terms in the relational model:

  • Relationship: a relationship corresponds to a table usually said;
  • Tuple: A row in the table is a tuple;
  • Attribute: a column in the table is an attribute, give each attribute a name that is the attribute name;
  • Code: An attribute group in the table, which can uniquely determine a tuple;
  • Domain: A domain is a collection of values ​​with the same data type. The value range of the attribute comes from a certain domain.
  • Component: an attribute value in the tuple;
  • Relationship mode: description of the corresponding relationship, generally expressed as: relationship name (attribute 1, attribute 2, …, attribute n)

The relationship model requirements must be standardized, that is, the relationship must meet certain normative conditions. The most basic of these normative conditions is: each component of the relationship must be an indivisible data item, that is, no table is allowed There are tables.

1.2.2.2 Data operation of relational model

SQL statement.

1.2.2.3, the integrity constraints of the relational model

The integrity constraints of the relationship mainly include three categories :

  1. Entity integrity constraints ;
  2. Referential integrity constraints ;
  3. User-defined integrity constraints .

3. The structure of the database system

The structure of the database system can be examined from many different levels or different angles. From the perspective of database application developers, database systems usually adopt a three-level model structure, which is the internal system structure of the database system. From the perspective of database end users, the structure of the database system is divided into single-user structure, master-slave structure, distributed structure, client-server, browser-application server/database server multi-layer structure, etc. These are all architectures outside the database system.

3.1, the concept of database system mode

There are the concepts of "type" and "value" in the data model. Type refers to the description of the structure and attributes of a certain type of data, and value is a specific assignment of type . Mode is a description of the logical structure and characteristics of all data in the database . It only involves the description of the type, not the specific value. A specific value of the pattern is called an instance of the pattern . There can be many instances of the same pattern. The model is relatively stable, while the instance is relatively variable , because the data in the database is constantly changing. The pattern reflects the structure and connection of the data, while the instance reflects the state of the database at a certain moment .

3.2, the three-level model structure of the database

Insert picture description here

  • mode

    Mode is also called logical mode, which is a description of the logical structure and characteristics of all data in the database, and is a common data view for all users . It is the middle layer of the database system, which neither involves the physical storage details of the data and the hardware environment, but also has nothing to do with specific applications, application development tools and high-level programming languages. A database can only have one schema. The database model is based on a certain data model .

  • Outer mode

    External mode is also called sub mode or user mode . It is a description of the logical structure and characteristics that database users can see and use, is a data view of database users , and is a logical representation of data related to a certain application. The outer mode is usually a subset of the mode. A database can have multiple external modes .

  • Inner mode

    The internal mode is also called the storage mode , and a database has only one internal mode . It is a description of the physical structure and storage of data, and the organization of data within the database . For example: whether the record is stored in heap storage or stored in ascending order of a certain attribute value; in what way is the index organized, is it a B+ tree or a hash index; can a record be stored across physical pages, etc.

3.3. The secondary image function and data independence of the database

In order to realize the connection and conversion of the above three levels of abstraction within the system, the database management system provides two layers of images between these three levels: external mode/mode image and mode/internal mode image . It is these two layers of images that ensure that the data in the database system can have high logical and physical independence .

  • External mode/mode image

    The mode describes the global logical structure of the data, and the outer mode describes the local logical structure of the data. When the mode is changed (for example, new relationships, new attributes, data types of attributes are changed, etc.), the database administrator makes corresponding changes to each external mode/mode image to keep the external mode unchanged. The application program is written according to the external mode of the data, so that the application program does not need to be modified, which ensures the logic independence of the data and the program, referred to as the logic independence of the data.

  • Mode/intra mode image

    When the storage structure of the database is changed (for example, another storage structure is selected), the database administrator can make corresponding changes to the schema/intra-mode image to keep the schema unchanged, so that the application does not need to be changed. Ensure the physical independence of data and programs, referred to as physical independence of data.

Guess you like

Origin blog.csdn.net/qq_36879493/article/details/108290681