Database Principles and Applications review the information

## Part 1: Overview of Database

* 1, * Basic Concepts

 - Data: data descriptor record things. (Basic objects stored in the database)
 - a database (DB): Data stored on a computer to store a certain format.
 - Database Data Features: permanently stored, organized, can be shared.
 - database management system (DBMS): designed to implement data management and system software maintenance.
 - Database Systems (DBS): by the database, the database management system (core), applications, database administrator components.

* 2, * data independence
 - Logical Independence: When content changes in the expression of the real world, does not affect the characteristics of the application.
 - physical independence: when the storage location and the data storage structure is changed, does not affect the characteristics of the application.

* 3, * shortcomings manage files

 - does not provide data sharing
 - data redundancy is inevitable
 - the lack of security
 - is not conducive to maintaining consistency of data
 - applications and file structure is tightly coupled

## Part 2: Database System Structure

* 1, * data characteristics
 
 - static features: including the basic structure of the data, the link between the data and the constraints on the range of data
 - dynamic feature: operate on the data that matches certain criteria, data query and change data
 
 * 2, the basic concept *
 - three elements data model: the basic structure of the data, constraint condition data, defined operation on the data (this is a dynamic characteristic)
 - data model: organization of data
 - data model classification (depending on the purpose of the model application) : conceptual data model layer, tissue layer data model

* 3, * conceptual data model layer

Yet conceptual data model layer conceptual model / model information, from the perspective of semantic data model to extract the application and press a user point to model the data and information.
It is the first abstraction of the real world to the world of information: the conceptual data model is a layer of abstraction of the real world, forming the world's information model.
Entity - Relationship model (ER FIG)
entities Contact: Contact-one (1: 1), many relationship (1: n-), contact-many (m: n)

* 4, * organizational hierarchy data model

Also known as tissue layer tissue model data model, data is organized according to a database will be described.
The second layer is an abstraction of the real world information: tissue layer data model is to abstract faith community and conversion, data organization model of the formation of a specific DBMS supports.
Four models: hierarchical model, the mesh model, ** ** relational model, object-oriented model
relational schema: relationship name (attribute 1, attribute 2)

5, the relational model data integrity constraints
entity integrity, with reference to intact, intact user-defined

6, the mode structure of the database system
 - the mode (storage mode): physical data storage, only one, not a relationship of
 - an outer mode (user mode or sub-mode): Data View, internal representation, the display data, a plurality
 - conceptual schema (logical mode or modes): contains all the data, it must be a relationship. It is a description of all the logical data structures and database features.
 
 External mode / image mode, mode / the pattern image
 
 7, DBMS function
 data definition, data manipulation, and performs optimization, security and data integrity, data recovery, and concurrency, data dictionary, the performance

## Part 3:SQL

* 1, SQL language functions and features *
functions: data definition, data query, data manipulation, data control

Features: integrated, highly automated, simple, can be used in a variety of ways

* 2, data integrity type *

 - Data integrity refers to the correctness and compatibility of data
 - entity integrity, referential integrity, the user-defined intact

* 3, * View
View is a logical window of data selected out of the base table in the database consisting of a combination of part of the basic table rows and columns of data.

* 4, * view of the benefits
 - to simplify data query
 - allows the user to look at the same data from multiple perspectives
 - to improve the security of data
 - it provides a degree of independence logic

* 5, * relational schema
 - dependent: all rely, in part dependent
 - Scaling: candidate code, the primary code, full code, outer code, the main property, non-primary property

* 6, * paradigm (of NF)
 - The first paradigm: not contain repeating groups
 - second paradigm: the paradigm is based on the first, non-primary attributes are fully dependent on the primary code
 - third paradigm: the second paradigm based on the non-primary property is not dependent on the primary code transmitted

## Part 4: protection of databases

* 1, * Basic Concepts

 - transaction: User defined data manipulation series
 - wherein the transaction (ACID characteristics): atomicity, consistency, isolation, durability
 - transaction database concurrency control and recovery of the basic unit

* 2, SQL * transaction model
two kinds of transactions: Transaction display, implicit transaction
show two transaction transaction model: ISO transaction model, T-SQL transaction model

* 3, data inconsistency caused by concurrent operation *

 - Modify loss of data
 - read "dirty" data
 - non-repeatable read
 - produce a "ghost" Data

* 4, concurrency control measures *

 - Shared locks: shared locks on the basis of a shared lock can be combined with
 - exclusive lock: With exclusive lock can not add any locks
 
 * 5, three locking protocol *
 [] (HTTPS: // img-Blog!. csdnimg.cn/20190615073109875.png)
 * 6, * serializable schedule
 for all transactions executed concurrently comply with two-phase locking protocol
two-phase locking protocol: everything must be carried out in two phases to lock and unlock data

* 7, * database failure
within a transaction failures, system failures, other failures

* 8, * database backup and restore
the full backup, differential backup, log backup

## ** Part 5: Database Design **

* 1, * the basic steps of database design
requirements analysis, design, behavior design, database implementation, database operation and maintenance phase

 - needs analysis: top-down, stepwise decomposition
 - Design: conceptual design, logical structure design, physical structure design
 - Design Concept: the ER Model

* 2, * composition database

 - two types of databases: Database system, a user database
 - consisting of two files: a data file (.mdf primary secondary .ndf), the log file (.ldf)

## Part 6: Data Query function statement


The SELECT * | <column name> | computed columns | constants are listed | count (*) | count ( distinct < column name>) | SUM (column name) | AVG (column name) | MAX (column name) | top n | top n percent | distinct

The FROM <table name> | <table 1, table 2, table name n> | the Join Table 1 Table 2 ON | Table 2 Table 1 left join ON

|WHERE =,>,!=|in()|between and|is null|>(),=()|and,or|like

|GROUP   BY

|HAVING

|ORDER BY asc|desc

|UNION | INTERSECT | EXCEPT

## Part 7: definition and data manipulation function clauses

Custom Functions

创建:CREATE TABLE <表名>(创建语句)
删除:DROP TABLE <表名1,表名2,表名N>
更新:ALTER TABLE <表名>
            ALTER COLUMN <列名> <类型>
           |DROP COLUMN <列名> 
           |ADD <列名> <类型> <约束>

Manipulation functions

插入:INSERT <表名>(列名) VALUES(值)
删除:DELETE <表名> 
更新:UPDATE <表名> SET <列名>=值

 

Guess you like

Origin blog.csdn.net/xlsj228/article/details/95249167