Key points of the database principle

Chapter One Introduction

1 Database related concepts

  1. Data : Symbolic records describing things

  2. Database : Long-term storage in the computer, organized, shareable data collection

    With less redundancy, higher data independence and easy scalability, and can be shared by users

  3. Database management system : a management software

  4. Database system : consists of databases, database management systems, application systems, database administrators, and users

    Database Administrator (DBA)


2 Database development

  1. Manual management stage : data is not independent, redundant, and not shared
  2. File system stage : poor independence, poor sharing, and high redundancy
  3. Database system stage : structured, good sharing, low redundancy, good independence

3 Elements of the data model

  1. Data structure : describe the static characteristics of the system
  2. Data manipulation : dynamic characteristics
  3. Data constraints : integrity rules

4 Conceptual model

  1. Substance : things that exist objectively and can be distinguished from each other
  2. Attribute : a certain characteristic of the entity
  3. Code : the attribute set that uniquely identifies the entity
  4. Domain : The value range of the attribute is called the domain of the attribute
  5. Entity type : Use a collection of entity names and their attribute names to abstractly describe similar entities
  6. Entity set : a collection of entities of the same type
  7. Contact : one to one, one to many, many to many

ER

Substance-rectangle

Attribute-ellipse

Contact-Diamond


5 Data model

  1. Hierarchical model -tree structure

  2. Mesh data model

  3. Relational data model -tables and tables

    Relational integrity constraints (entity integrity, referential integrity, user-defined integrity)


6 Three-level model structure of database system

  1. Mode (logical mode) : the description of the logical structure and characteristics of all data in the database, which is a common data view for all users

    A database has only one mode

  2. External mode (submode/user mode) : It is the description of the logical structure and characteristics of the local data that the database user sees and uses, and is the data view of the database user

    A database can have multiple external modes

  3. Internal mode (storage mode) : is the description of the physical structure of the data and the storage structure

    A database has only one internal schema

For each external mode, the database system has an external mode/mode image

Mode/intra mode image is unique

Chapter 2 Relational Database

1 Concept

  1. Candidate code : If the value of a certain attribute group in the relationship can uniquely identify a tuple, and its proper subset is not enough, then the attribute group is a candidate code
  2. Main code : Choose one of the candidate codes as the main code
  3. Primary attributes : the attributes of the candidate code become attributes
  4. Non-code attributes : attributes not included in any candidate codes
  5. Relationship mode : R(U,D,DOM,F)
    • R: Relationship name
    • U: The set of attribute names that make up the relationship
    • D: The domain from which the attribute in U comes from
    • DOM: a collection of attributes to domain mapping
    • F: A collection of data dependencies between attributes

2 Relationship integrity

  1. Entity integrity : all main attributes cannot take null values, not just the main code attributes
  2. Referential integrity : foreign code correspondence
  3. User-defined integrity : constraints on a certain attribute

Chapter 5 Database Security

1 business

Start with BEGIN TRANSACTION and end with COMMIT or ROLLBACK

ACID

  • Atomicity (atomicity): indivisible, the operations in a transaction are either done or not done
  • Consistency: From one consistency state to another consistency state
  • Isolation (isolation): the execution of one thing cannot be interfered by another transaction
  • Durability: Once a thing is submitted, its changes to the database data should be permanent

2 Concurrent operation and data inconsistency

  1. Lost changes

  2. Not repeatable

  3. Dirty read

Guess you like

Origin blog.csdn.net/weixin_46250447/article/details/111970200