The basic concept

Data: Symbolic records that describe things are called data.

DataBase (DB) : A collection of large amount of data stored in a computer for a long time, organized and shareable. It has three basic characteristics: permanent storage, organized and shareable.

DataBase Management System (DBMS) : is a layer of data Management software between the user and the operating System.

DataBase System (DBS) : A System consisting of a DataBase, a DataBase management System (and its application development tools), application programs, and a DataBase Administrator DBA that stores, manages, processes, and maintains data.

Entity: An object that exists and can be distinguished from one another.

Attribute: A property of an entity is called an attribute.

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

Entity Type: The entity name and its attribute name set are used to abstract and depict similar entities.

Entity Set: SETS of the same entity type are called entity sets.

Relationship: Relationships between entities usually refer to relationships between different sets of entities.

Schema: A schema is also called a logical schema. It describes the logical structure and features of all data in a database and provides a common data view for all users.

External Schema: An external schema is also called a subschema or a user schema. It is a description of the logical structure and characteristics of local data that can be seen and used by database users (including application programmers and end users). It is a data view of database users and a logical representation of data related to an application.

An internal schema is also called a storage schema. A database has only one internal schema. It is a description of the physical structure and storage of data, and how the database is organized within the database.

Common data models

Hierarchical Model

Network Model

Relational Model

(1) Relation: A relation corresponds to what is usually called a table

(2) Tuple: A row in a table is a tuple

(3) Attribute: A column in a table is an attribute

(4) code (key) : a group of attributes in the table that can uniquely identify a tuple

(5) Domain: a set of values with the same data type

(6) Component: an attribute value in a tuple

(7) Relationship mode: The description of the relationship, generally expressed as the name of the relationship (attribute 1, attribute 2… Attributes, n)

Object Oriented Data Model

Object Relational Data Model

Semistructure Data Model

Common SQL operations

Relational database

Basic relational operations: query (select, projection, join (equivalent join, natural join, outer join (left outer join, right outer join)), division, union, difference, intersection, Cartesian product, etc.), insert, delete, modify

There are three types of integrity constraints in relational models: entity integrity, referential integrity, and user-defined integrity

The index

Database indexes: sequential index, B+ tree index, hash index

Database integrity

The integrity of database is the correctness and compatibility of data.

Integrity: To prevent the existence of semantically incorrect (incorrect) data in the database.

Security: To protect the database from malicious damage and illegal access.

Trigger: A special class of event-driven procedures defined by users in relational tables.

Relational data theory

Data dependence is a constraint relation between attributes within a relationship, and it is a correlation relation between data reflected by the equality of values between attributes.

The most important data dependencies: function dependencies, multivalued dependencies.

paradigm

First Normal Form (1NF) : Attributes (fields) are the smallest units that are not divisible.

Second normal form (2NF) : satisfy 1NF, where each non-primary attribute is completely dependent on the primary key (eliminating partial functional dependence of 1NF non-primary attribute on the code).

Third normal form (3NF) : satisfying 2NF, any non-primary attribute is not dependent on other non-primary attributes (eliminating the transfer function dependence of 2NF non-primary attributes on codes).

Boys-coad normal form (BCNF) : satisfying 3NF, any non-primary attribute cannot depend on a primary key subset (eliminating the partial and transfer function dependence of 3NF primary attributes on codes).

Fourth normal form (4NF) : satisfying 3NF, there can be no non-trivial and non-functional multi-valued dependencies between attributes (eliminating 3NF non-trivial and non-functional multi-valued dependencies).

Database Recovery

Transactions: A user-defined sequence of database operations that either do all or none of them and are an indivisible unit of work.

ACID properties: atomicity, consistency, isolation, persistence.

Recovery technology: establish redundant data -> use redundant data to implement database recovery.

Common techniques for creating redundant data include data dump (dynamic massive dump, dynamic incremental dump, static massive dump, and static incremental dump) and log file registration.

Concurrency control

Transactions are the basic unit of concurrency control.

Data inconsistencies caused by concurrent operations include lost data, unrepeatable data, and dirty data.

Concurrency control technology: blocking, timestamp, optimistic control, multi – version concurrency control, etc.

Basic locking types: exclusive (X lock/write lock), shared (S lock/read lock).

Live deadlock:

(1) Live lock: transactions are always in a waiting state, which can be avoided by a first-come-first-served policy.

(2) Deadlock: transaction can never end

A, prevention: a blockade, sequential blockade;

B. Diagnosis: timeout method, wait chart method;

Release: Unlocks the transaction that is least costly to handle deadlocks and releases all locks on this transaction, allowing other transactions to continue.

Serializable scheduling: Concurrent execution of multiple transactions is correct if and only if the result is the same as if the transactions were executed serially in some order. Serializability is a criterion for the correct scheduling of concurrent transactions.

This is the end of today’s sharing, you must learn C++ yo ~

For those of you who are ready to learn C/C++ programming, if you want to improve your core programming skills, you might as well start now!

Wechat official account: C language programming Learning base

Organize and share (years of learning source code, project actual combat video, project notes, basic introduction tutorial)

Welcome to change careers and learn programming partners, use more information to learn and grow faster than their own thinking oh!