Notes Principles of Database Systems

https://www.bilibili.com/video/av39805477?p=1

1 Database System Overview

Basic Concepts 1.1 Database

Data Definition

Data descriptor record things. Data are the information carrier, the information data is reflected.

Database definition

The database is a long-term permanent storage in the computer, organized , sharable large data sets.

Database management system -defined

A database management system (DBMS) and operating system is located in the user data management software layer.
The main function:

  • Data Definition Functions: providing data in the database data definition language (DDL) is defined. Such as tables, views, stored procedures, triggers, and the like;
    - data manipulation functions: providing a data manipulation language (DML) manipulating the data to achieve the basic operation of the database. Such as query, insert, delete, modify,
  • Operation and management of the database: to ensure the security, integrity, multi-user concurrent use of data and data of the system after a failure recovery.
  • The establishment and maintenance of the database: create database, database maintenance, restore, recharge groups, performance monitoring analysis
  • Data organization, storage, management functions: index search, sequential search
  • Other functions: communication with other network software, data transmission, mutual access and other functions

Database System Definition

Database system DBS,
refers to the introduction of the system after the database in the computer art. Usually a complete database system includes a database, database management systems and related tools, applications, database administrators and users.
Database administrators Datebase administrator responsible for database maintenance, and protect the normal and efficient operation of the database.

1.2 Development of data management technology

Artificial management phase: can not store

File System Stage: different file formats, can not be shared not universal

Database system phases:

Data Integration 1
2 high data sharing (qq login with micro-channel)
3 small redundancy data (database table structure designed)
4 data consistency (table structure without a plurality of different copies)
5 high data independence (and procedures low correlation, independent existence)
6 unified management and control
workload 7 to reduce application development and maintenance

1.3 Structure Database System

Three mode configuration database system

  • Mode 1
    mode is also referred to as a logical model or conceptual model, which is a description of all data and the logical structure of the database features is a common view of all users.
    (Including a view of the relationship)
  • Mode 2 outer
    representation of the logical structure and local data characteristic mode is also called an outer sub-mode or user-mode subschema, which is a user database, including the application programmers and end users can see and use.
    (Not including the Relations separate views)
  • 3 the mode
    is also referred to as the storage mode, the database is a description of the physical structure and data storage method, is a representation of the data in the internal database.
    (Computer memory)

Data independence

  • Logical data independence

And an outer mode map mode and the independent mode
(machines with what program function does not affect the deposit)

  • Physical data independence

Mode and the image mode, regardless of the mode of external
(outer seen, the change does not matter which themselves)

Operation and application structure database system

  • Client / server C / S mode
    such as QQ, the desktop client game. You need to download.
  • Browser / Server B / S mode
    such as websites, online web games. No need to download.

1.4 Data Model

1.4.1 Registration data characteristics and data model elements

  • A data structure of
    a data structure describes the static characteristics of the system, i.e., the type of data link between the data object, content, attributes, and data objects.
  • 2 data manipulation
    data manipulation are described in the dynamics of the system, is a collection of examples of the operation of the operation performed various objects, including rules relating to the operation and the operation.
  • 3 data constraints
    data associated syntactic and semantic constraints between the data structure description data. Including mutual constraints and dependencies and dynamically change the rules of data to ensure accuracy, validity, compatibility of data. (Such as entry points when the score limit)

Classification 1.4.2 Data Model

Conceptual data model layer 1
(1) the basic concepts of the world of information

Entity Entity: the objective existence and mutual differences become physical entity.
Property attribute: a feature called entity owned some property.
Code key: the set of attributes that uniquely identifies the entity called code
domain domain: Domain attribute value range of the attribute called
entity type entity type: Entity name and attribute name and a set of abstract type characterize entities.
Entity set entity set: a collection of the same type of entity is called an entity set
Contact relationship: the link between the real world and the kind reflected in the internal physical link between the interior and entities associated with entities in the information world. Entity type contact: one to many, one to one, many to many.
Representation (2) conceptual model (focus)
conceptual model: used to describe the real world has nothing to do with the kind ,, specific computer systems.
Here Insert Picture Description
Here Insert Picture Description

Layer 2 logical data model
(1) hierarchical model
(2) a mesh model
(3) Relationship model (key)
(4) facing the object model

3 physical layer data model
has a physical layer corresponding to stores.

2 relational database

2.1 relational database Overview

Relational database application of mathematical methods to process data in the database.

2.2 Relational Data Model

Relational data structures: data structure of the relational model is very simple, containing only a single data structure, namely the relationship. (Two-dimensional table)

Basic terms:

  • Table Table
  • Relations Relation
  • Column column, also known as fields, properties
  • Row row also called tuples, records
  • Component: a tuple attribute value
  • Also called key code key
  • Super Size or Super key
  • Candidate or a candidate key code
  • A primary key or master key
  • Full or full key code
  • Primary and non-primary property attributes
  • Outer code or foreign key
  • Referring to the relationship and the relationship between the reference
  • area
  • Data type (for limiting)
  • Relational schema
  • relational database

Relationship set of operations

1 basic relational operations

  • Query : union, intersection, Cartesian product, in addition, to find (return line), the projection (back row), and the like are connected
  • Data Update
  • Features relations operation

Category 2 language relational data
into algebraic (comparison operator) and logically (logical operator).

The proposed database integrity constraints

  • Entity integrity constraints: master code can not be empty
  • Referential integrity constraint: foreign key
  • User-defined integrity constraints: range from definitions like ah

2.3 relational database normalization theory (focus)

Database, there may be some problems

Data redundancy
update anomalies
inserted into the abnormal
remove exception

Functional dependencies with keywords

Function where, X is unique to Y, X Y is called the determining factor.

Fully functional dependency

Function dependent part

Dependent transfer function

Paradigms and relations normalization process

3 Database Design

3.1 Overview

Design goal: to meet the functional requirements of the application, have a good database performance (PB big data performance level).

Database design is from the user demand for data, research and database construction process, including database design and database design behavior (performance tuning).

Design Method: Hair intuitive design, process design specifications (including Design New Orleans, ER model database design method based on the design method of the third paradigm), computer-aided design method (for large companies complex data relationships, some tools UML: ROSE, VISIO, powerdesigner).

designing process:
Here Insert Picture Description

3.2 Basic Steps

1 needs analysis

  1. Determine the scope of the database
  2. Application Process Analysis
  3. Data collection and analysis (static structure, a dynamic structure, data constraint)
  4. Preparation of needs analysis
    Here Insert Picture Description

2 conceptual design
the ER diagram to describe the concept structure model.

3 logical structure design

4 physical design
(access method, the index, the physical block size, the number and size of the buffer, the compressed data selection)
Here Insert Picture Description

Database Embodiment 5
(1) loading data
(2) application design
(3) test run database

6 operation and maintenance of the database
maintenance in the most difficult database reorganization and reconstruction of the studio system.

3.3 Design Method

Here Insert Picture Description
FIG ER: 1 to 1, 1 to N, N-to-1

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

4 SQL relational database basic operation

4.1 SQL Overview

Structured Query Language Query Language Structured
SQL is not case sensitive

4.2 MySQL Preliminaries

Here Insert Picture Description
MYSQL within the pattern (file storage)
Here Insert Picture Description

mysql constant for some data types: binary, hexadecimal, integer, float, NULL, date, and time
variables: @ variable is incremented until the user, before the system variable @ plus two
Here Insert Picture Description
operators:

      • /% (Modulo)
        & | ~ << >>
        ! => <<=> = =
        Logical NOT NOT logic OR or logic AND and XOR logic Yihuo

Expression
character expression, numeric expressions, a date expression

Built-in functions
Here Insert Picture Description

4.3 Data Definition

4.4 Data Update

4.5 Data Query (Key)

4.6 view

It is something outside the pattern.
A view is a virtual table.
Defined by a rear view, as a table can be CRUD.

5 Database Programming

Here Insert Picture Description
A stored procedure is a set of functions in order to complete a specific set of sql statement. In fact, this is the piece of code stored in the database, it may consist of declarative and procedural sql statement sql statements.
The advantages of using stored procedures:

1 to improve the operating speed
2 increases the functionality and flexibility of sql
3 can reduce network traffic
4 prepared by reducing the workload of the program
5 of the security control functions indirectly

6 Database Security and Protection

Here Insert Picture Description

Application design and development of database instance 7

8 database management technology development

Published 105 original articles · won praise 8 · views 10000 +

Guess you like

Origin blog.csdn.net/x1131230123/article/details/104392093