The first lecture of the database review: Introduction

This compilation is only an auxiliary function, and PPT is the Dragon Swordsman. The
follow-up may be organized, but it will not be so detailed (It would be better to look at the PPT, right?

The first lecture of the database review: Introduction

1.1 Overview of the database system

1.1.1 Four basic concepts

  • Data
  • Basic objects stored in the database
  • Definition: a symbolic record describing things
  • Types: numbers, text, graphics, etc.
  • The meaning of data is called the semantics of data, and data and its semantics are inseparable
  • Database
  • Definitions : a long-term storage in the computer, organized , and can share the large amount of aggregate data
  • Basic Features
  • Data is organized, described and stored according to a certain data model
  • Can be shared for various users
  • Less redundancy
  • High data independence
  • Easy to expand
  • Database Management System (DBMS)
  • meaning
  • A layer of data management software between the user and the operating system
  • It's basic software, it's a large and complex software system
  • Purpose: scientifically organize and store data, efficiently obtain and maintain data
  • The main function
  • Data definition function
  • Provide data definition language (DDL)
  • Define the data objects in the database
  • Data organization, storage and management
  • Classified organization, storage and management of various data
  • Determine the file structure and access method of the organization data
  • Realize the connection between data
  • Provide multiple access methods to improve access efficiency
  • Data manipulation function
  • Provide data manipulation language (DML)
  • Realize basic operations on the database (addition, deletion, modification, and check)
  • Database transaction management and operation management
  • The database is uniformly managed and controlled by the database management system during establishment, operation and maintenance
  • Ensure data security, integrity, and concurrent use of data by multiple users
  • System recovery after failure
  • Database establishment and maintenance function
  • Loading and conversion of database initial test data
  • Database dump and restore function
  • Reorganization of the database
  • Performance monitoring, analysis, etc.
  • Other functions
  • Communication between database management system and other software systems in the network
  • Data conversion between database management systems
  • Inter-access and interoperability between heterogeneous databases
  • Database System (DBS)
  • constitute
  • database
  • Database management system (and its application development tools)
  • application
  • Database administrator

1.1.2 The emergence and development of data management technology

Data management technology

description

  • Classify, organize, code, store, retrieve and maintain data
  • The central issue of data processing

development process

Manual management stage (before the mid-1950s

File system stage (late 1950s-mid 1960s

Database system stage (late 1960s-present

File system to database system, marking a leap in data management technology

Development motivation

  • Driven by application demand
  • The development of computer hardware
  • The development of computer software

1.1.3 Features of the database system

  • The overall structure of the data
  • Is one of the main characteristics of the database
  • description
  • No longer just for a certain application, but for the whole organization
  • Not only the data is internally structured, the whole is structured, but there is a connection between the data
  • Data records can be lengthened
  • The smallest access unit of data is data item
  • High data sharing, low redundancy and easy to expand
  • Data faces the entire system and can be shared and used by multiple users and multiple applications
  • Benefits of data sharing
  • Reduce data redundancy and save storage space
  • Avoid incompatibility and inconsistency between data
  • Make the system easy to expand
  • High data independence
  • Physical independence: the user's application and the data storage in the database are independent of each other
  • Logical independence: the user's application and the logical structure of the database are independent of each other
  • Data independence is guaranteed by the secondary image function of the database management system
  • The data is uniformly managed and controlled by the database management system
  • Data control function provided by database management system
  • Data security protection
  • Data integrity check
  • Concurrency control
  • Database recovery

1.2 Data model

  • The data model is an abstraction of the characteristics of real world data
  • Is a simulation of the real world
  • Meet three requirements
  • Simulate the real world more realistically
  • Easy to understand
  • Easy to implement on the computer
  • Data model is the core and foundation of database system

1.2.1 Two types of data models

  • Conceptual model
  • Also known as information model, it is used to model data and information according to the user's point of view, and is used in database design
  • Logical and physical model
  • Model data from the viewpoint of computer system for DBMS implementation
  • An abstraction of the lowest level of data, describing the representation and access methods of data online and internal, storage methods and access methods on disks or tapes

1.2.2 Conceptual model

  • use
  • Modeling for the information world
  • Is an intermediate level from the real world to its world
  • Is a powerful tool for database design
  • The language of communication between database designers and users
  • basic requirements
  • Strong semantic expression ability
  • Simple, clear and easy for users to understand
  • Basic concepts in the information world
  • entity
  • Internal connection: between attributes
  • Connection: between different entity sets
  • Attributes
  • code
  • Physical
  • Entity set
  • contact

1.2.3 Elements of the data model

  • data structure
  • Describe the constituent objects of the database and the connections between the objects
  • Is a description of the static characteristics of the system
  • Data manipulation
  • A collection of operations allowed to be performed on instances (values) of various objects (types) in the database , including operations and related operating rules
  • Type: Additions, deletions, revisions and checks
  • Is a description of the dynamic characteristics of the system
  • Data integrity constraints
  • A set of integrity rules
  • Integrity rules: given are the constraints and dependency rules of the data and its connections in the data model
  • Used to limit the status of the database in accordance with the data model and the changes in the status to ensure the correctness, validity and compatibility of the data

1.2.4 Commonly used data models

Hierarchical model

Mesh model

Relational model

Object-oriented data model

Object Relational Data Model

Semi-structured data model

1.2.5 Hierarchical Model

It is the earliest data model in the database system
Use a tree structure to represent various entities and the connections between entities
  • data structure
  • To meet the conditions
  • One and only one root node
  • Nodes other than the root have one and only one parent node
  • Features
  • The parent of the node is unique
  • Can only directly handle one-to-many entity connections
  • Each record type can define a sort field, also known as a code field
  • Any record value can only show its full meaning when viewed by its path
  • No child record value can exist independently of the parent record value
  • Data manipulation
  • Additions, deletions, revisions
  • Integrity constraints
  • Without the corresponding parent node value, the child node value cannot be inserted
  • If the parent node value is deleted, the corresponding child node value is also deleted at the same time
  • During the update operation, all corresponding records should be updated to ensure data consistency
  • advantage
  • The data structure of the hierarchical model is relatively clear
  • High query efficiency, performance is better than relational model, not lower than mesh model
  • Hierarchical data model provides good integrity support
  • Disadvantage
  • Many-to-many connections between nodes are unnatural
  • There are many restrictions on insert and delete operations, and application programming is more complicated
  • Query the child node must pass the parent node
  • Hierarchical commands tend to be programmed

1.2.6 Mesh model

The mesh database adopts the mesh model as the data organization method
  • data structure
  • To meet the conditions
  • Allow more than one node without parents
  • A node can have more than one parent
  • Difference from hierarchical model
  • The mesh model allows multiple nodes without parent nodes
  • The mesh model allows a node to have multiple parent nodes
  • The mesh model allows multiple connections between two nodes
  • The mesh model can describe the real world more directly
  • The hierarchical model is actually a special case of the mesh model
  • Data manipulation and integrity constraints
  • Code: a collection of data items that uniquely identifies the record
  • One-to-many contact between parent records and child records in a contact
  • Support certain constraints between parent records and child records
  • advantage
  • Can describe the real world more directly, such as a node can have multiple parents
  • Has good performance and high access efficiency
  • Disadvantage
  • The structure is more complex, and with the expansion of the application environment, the structure of the database becomes more and more complex, which is not conducive to the end users
  • The DDL and DML languages ​​are complex and difficult for users to use
  • The connection between records is realized through the access path, and the user must understand the details of the system structure

1.2.7 Relational Model

Relational database adopts relational model as the way of data organization

data structure

From the user's point of view, the data structure in the relational model is a two-dimensional table consisting of rows and columns

image-20210608154702298

Tables are not allowed in the table, the relationship must be canonical

Data operation is a set operation, the operation object and the operation result are both related

  • Additions, deletions, revisions

Integrity constraints

  • Physical integrity
  • Referential integrity
  • User-defined integrity

advantage

  • Based on strict mathematical concepts
  • Single concept
  • Entities and all kinds of connections are represented by relationships
  • The results of data retrieval are also related
  • The access path of the relational model is transparent to the user
  • Have higher data independence, better security and confidentiality
  • Simplifies the work of programmers and the work of database development and establishment

Disadvantage

  • The access path is transparent to the user, and the query efficiency is often not as good as the formatted data model
  • In order to improve performance, the user's query request must be optimized, which increases the difficulty of developing a database management system

1.3 The structure of the database system

  • From the perspective of database application developers , the database usually adopts a three-level model structure, which is the internal system structure of the database system
  • From the perspective of database end users , the database structure is divided into
  • Single user structure
  • Master-slave structure
  • Distributed structure
  • Client-server
  • Browser-application server/database server multi-layer structure, etc.

1.3.1 The concept of database system schema

Type (type): description of the structure and attributes of a certain type of data

Value (value): is a specific assignment of type

Schema

  • Is a description of the logical structure and characteristics of the database
  • Is a description of the type, does not involve specific values
  • Reflects the structure of the data and its connections
  • The model is relatively stable

Instance

  • A specific value of the pattern
  • Reflect the state of the database at a certain moment
  • There can be many instances of the same pattern
  • The instance changes with the update of the data in the database

1.3.2 The three-level model structure of the database system

image-20210608195354081
  • Mode (also known as logical mode)
  • description
  • Description of the logical structure and characteristics of all data in the database
  • Public data for all users
  • A database has only one mode
  • Status: It is the middle layer of the database system schema structure
  • It has nothing to do with the physical storage details of the data and the hardware environment
  • Has nothing to do with specific applications, development tools and high-level programming languages
  • definition
  • The logical structure of the data (the name, type, value range of the data item, etc.)
  • Links between data
  • Data-related security and integrity requirements
  • External mode (also called sub mode or user mode)
  • description
  • Description of the logical structure and characteristics of local data used by database users
  • The data view of the database user is a logical representation of data related to a certain application
  • Status: between mode and application
  • The relationship between mode and external mode: one-to-many
  • The relationship between external mode and application: one-to-many
  • use
  • A powerful measure to ensure database security
  • Each user can only see and access the data in the corresponding external mode
  • Internal mode (also known as storage mode)
  • description
  • Is a description of the physical structure and storage of the data
  • Is the representation of data inside the database
  • A database has only one internal schema

1.3.3 The secondary image function and data independence of the database

The three-level mode is three abstract levels of data

The secondary image realizes the connection and conversion of these three abstract levels within the database management system

External mode / mode image

  • description
  • Mode: describes the global logical structure of the data
  • Outer mode: describes the local logical structure of the data
  • The same pattern can have any number of outer patterns
  • For each external mode, the database system has an external mode/mode image, which defines the corresponding relationship between the external mode and the mode
  • The image definition is usually included in the description of the respective external mode
  • Ensure data independence
  • When the mode is changed, the database administrator makes corresponding changes to the external mode/mode image to keep the external mode unchanged
  • The application program is written according to the external mode of the data, and 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/Internal Mode Image

  • description
  • Defines the correspondence between the global logical structure of the data and the storage logical structure
  • The schema/internal schema image is unique in the database
  • The image definition is usually included in the schema description
  • Ensure the independence of data
  • When the storage structure of the database is changed, the database administrator modifies the mode\internal mode image, so that the mode remains unchanged
  • The application is not affected. Ensure the physical independence of data and programs, referred to as physical independence of data
  • Database schema
  • That is, the global logical structure is the center and key of the database
  • Independent of other levels of the database
  • When designing the database schema structure, you should first determine the logical schema of the database
  • Internal schema of the database
  • Depends on its global logical structure
  • User attempts independent of the database, that is, the outer mode
  • Independent of specific storage devices
  • Organize the data structure and its connections defined in the global logical structure according to a certain physical storage strategy to achieve better temporal and spatial efficiency
  • Outer schema of the database
  • Specific application
  • Defined on the logical model
  • Independent of storage mode and storage device
  • When the application requirements change significantly and the corresponding external mode cannot meet its view requirements, the external mode must be changed accordingly
  • The scalability of the application should be fully considered when designing the external mode
  • Specific application
  • Compiled on the data structure described by the external model
  • Depends on a specific external model
  • Independent of database schema and storage structure
  • Different applications can sometimes share the same external mode
  • Secondary image of the database
  • Ensure the stability of the database outside the model
  • The stability of the application is guaranteed from the bottom, unless the application requirements themselves change, the application generally does not need to be modified
  • The independence between the data and the program allows the definition and description of the data to be separated and removed from the application
  • Data storage is managed by the database management system
  • Simplified application programming
  • Greatly reduce the maintenance and modification of the application

1.4 The composition of the database system

  • database
  • Database management system (and its development tools)
  • application
  • Database administrator
  • Hardware platform and database
  • Enough memory
  • Sufficiently large disks or disk arrays and other equipment
  • Higher channel capacity, increase data transfer rate
  • software
  • Database management system
  • Support the operating system allowed by the database management system
  • High-level language interfaced with database and its compiling system
  • Application development tool centered on database management system
  • Database application system developed for specific application environment
  • personnel
  • Database administrator
  • Duties
  • Determine the content and structure of the information in the database
  • Decide on the storage structure and access strategy of the database
  • Define data security requirements and integrity constraints
  • Monitor the use and operation of the database
  • Improvement and reorganization of the database
  • System analysts and database designers
  • System analyst
  • Responsible for the requirement analysis and specification of the application system
  • Combine with users and database administrators to determine the hardware and software configuration of the system
  • Participate in the outline design of the database system
  • Database designer
  • Participate in user needs survey and system analysis
  • Determine the data in the database
  • Design database patterns at all levels
  • Application programmer
  • Design and write program modules for application systems
  • Commissioning and installation
  • end user
  • The end user uses the database through the user interface of the application system
  • Casual user
  • The database is not frequently accessed, but different database information is often required for each visit
  • Senior and mid-level managers of enterprises or organizations
  • Simple user
  • The main job is to query and update the database
  • Bank staff, ticket reservation staff, hotel receptionist
  • Complex user
  • Directly use database statements to access the database, and even compile your own application programs based on the application program interface of the database management system
  • Engineers, scientists, economists, scientific and technological workers, etc.

1.5 Summary

Database system overview

  • Basic concepts of database
  • The development process of data management
  • Characteristics of database system

Data model

  • The three elements of the data model
  • Three main database models

The internal system structure of the database system

  • Three-level model structure of database system
  • Two-tier image system structure of database system

The composition of the database system