Database-Introduction to databases
Database status
Since the end of 1960s, database technology was the latest technology in data management and an important branch of computer science.
Database technology is the core and foundation of information systems. Its emergence has greatly promoted the penetration of computer applications into all walks of life.
The scale of database construction, the size and frequency of database information have become an important indicator to measure the informatization degree of a country.
Data
Data) it is the definition of basic object data stored in the database. It describes the types, texts, images, images, audios, videos, student archive records, shipping status, and other data of the symbolic record data of a thing. feature data and its semantics are inseparable
The meaning of data is called the meaning of data, and the meaning of data is inseparable.
For example, 93 is a data
Semantic 1: score of a student in a course
Semantics 2: the weight of a person
Semantic 3: 2003 students in the computer department
Student records in the student Archive
(Li Ming, male, 197205, Nanjing, Jiangsu, Department of Computer Science, 1990)
Semantics: Student name, gender, date of birth, nationality, department,
Admission time
Description: Li Ming is a college student. He was born in Nanjing, Jiangsu Province in May 1972. He was admitted to the computer department in 1990.
Database
Database definition Database (DB) is a set of large amounts of data that has been stored in a computer for a long time, organized, and shared. The basic feature data of the database is organized, described, and stored according to a certain data model, which can be shared by various users with a low degree of redundancy. Data independence is highly scalable.
Database Management System
What is DBMS and Database Management System?
A layer of data management software located between the user and the operating system.
It is basic software and a large and complex software system.
Commercial Products: Oracle, SQL Server, DB2, Sybase, Informix
Open-source products: MySQL and Berkeley DB
Usage of DBMS
Scientifically organize and store data and efficiently obtain and maintain data.
Data Definition Function
Provides Data Definition Language (DDL)
Define data objects in the database
Data organization, storage and management
Organize, store, and manage data by category
Determine the file structure and access method of organization data
Connect data
Provides multiple access methods to improve access efficiency
Data manipulation
Data manipulation language (DML)
Basic Database Operations (query, insert, delete, and modify)
Database Transaction Management and Operation Management
The database is centrally managed and controlled by the DBMS during database creation, operation, and maintenance.
Ensures data security and integrity, and concurrent use of data by multiple users
Transaction recovery after a fault occurs
Database Management
What is Data Management?
Classify, organize, encode, store, retrieve, and maintain data
Data processing center problems
Development Process of Data Management Technology
Manual management stage (mid-December 1940s-mid-December 1950s)
File System stage (late 1950s-mid 1960s)
Database System stage (end of 1960s-now)
Database System features
Data structuring
High data sharing, low redundancy, and easy expansion
High Data independence
Data is centrally managed and controlled by DBMS
Structured data is one of the main features of a database.
Overall Structure
Not only for a specific application, but for the entire Organization
Not only is the data structured internally, but the whole is structured and there is a link between the data
What the database implements is the true structure of data.
The data structure is described by the data model, without the need for program definition and interpretation.
Data can become longer
The minimum unit of data access is data items.
The database system looks at and describes data as a whole. Data is oriented to the entire system and can be shared and used by multiple users and applications.
Benefits of data sharing
Reduces data redundancy and saves storage space
Avoid data inconsistency and inconsistency
Easy System Expansion
Physical independence
Data in your applications and databases stored on disks is independent of each other. When the physical storage of data changes, applications do not need to change.
Logical independence
The logical structure (logical mode) of your applications and databases is independent of each other. The logic structure of the data has changed, and the user program can remain unchanged.
Data independence is guaranteed by the DBMS's second-level image function.
Data Control function provided by DBMS (1) Data Security protects data to prevent data leaks and damages caused by illegal use. (2) Data Integrity (Integrity) Check to control the data within the valid range, or ensure that the data meets a certain relationship. (3) Concurrency controls and coordinates concurrent operations of multiple users to prevent mutual interference and get incorrect results. (4) database Recovery restores the database from the error state to a known correct state.
Data Model
Abstract: extract common and essential features from numerous things, and discard non-essential features. For example, apple, bananas, raw pears, peaches, and so on. They share the same characteristics as fruits. The process of getting the concept of fruit is an abstract process. To be abstract, you must compare them. If there is no comparison, you cannot find a common part. Common features are the features that distinguish a class of things from other things. These differentiated features are also called essential features. Therefore, the common feature of extracting things is to extract essential features of things and discard non-essential features.
There are two types of data models (two different layers)
(1) the conceptual model, also known as the information model, is used to model data and information from the user's point of view for database design.
(2) logical and physical models
Logical models mainly include mesh models, hierarchical models, relational models, and object-oriented models. Data is modeled based on computer systems and used for DBMS implementation.
The physical model is the abstraction of the bottom layer of data. It describes the representation and access methods of data in the system, and the storage and access methods on disks or tapes.
Data Structure
What is data structure?
Describes the database composition objects and the relationships between objects.
Description
Objects related to the data type, content, and nature
Objects related to data connections
The data structure describes the static features of the system.
Data Operations
Data Operations
Instances (values) of various objects (types) in the database that can be executed
Operations and related operation rules
Data Operation Type
Query
Update (including insert, delete, and modify)
Data Model Definition of operations
EXACT MEANING OF THE OPERATION
Operation symbol
Operation Rules (such as priority)
Operating Language
Data operations are a description of the dynamic features of the system.
Constraints on Data Integrity
Constraints on Data Integrity
A set of integrity rules.
Integrity rules: Constraints and dependency rules for data and their links in a given data model
It is used to limit the database status and status changes that conform to the data model, so as to ensure that the data is correct, valid, and compatible.
Definition of integrity constraints in Data Models
Reflects and specifies the basic general integrity constraints that this data model must comply. For example, in a relational model, any link must meet two conditions: entity integrity and reference integrity.
Provides a mechanism for defining integrity constraints to reflect the specific semantic constraints that must be observed for data involved in a specific application.
Conceptual Model
Usage of the Conceptual Model
Conceptual Model Used for modeling the information world
It is an intermediate layer from the real world to the machine world.
It is a powerful tool for database design.
Language of communication between database designers and users
Basic Requirements for Conceptual Models
Strong semantic expression capability
Can easily and directly express various semantic knowledge in applications
Simple, clear, and easy to understand
Basic concepts in the information world
(1) The Entity exists objectively and can be differentiated from each other. It can be a specific person, thing, thing, or abstract concept. (2) An Attribute is a property. An object can be characterized by several attributes. (3) The property set that uniquely identifies an object is called a code. (4) The value range of the Domain attribute is the Domain of this attribute. (5) Entity Type abstracts and depicts similar entities using Entity names and their attribute names. (6) A Set of entities of the same type is called a Relationship) in the real world, the connections between things inside and between things are reflected in the information world as those between entities. The internal link of an object usually refers to the link between attributes of an object. The link between entities usually refers to the link between different object sets.
Common Data Models
Non-Relational Model
Hierarchical Model)
Network Model)
Relational Model)
Object Oriented Model)
Object Relational Model)
Hierarchical Model
Hierarchical Model is the earliest data model in the database system.
A typical example of a hierarchical database System is the ibm ims (Information Management System) database Management System.
The hierarchical model uses a tree structure to represent the relationships between various entities and entities.
Hierarchical Model
The set of basic hierarchical links that meet the following two conditions is a hierarchical model.
1. There is only one node with no parent node. This node is called the root node.
2. Other nodes except the root node have only one parent node.
Several terms in the layered model
Root Node, parent node, sibling node, leaf node
Hierarchical Model features:
The parent node is unique.
Only one-to-many physical connections can be processed directly.
Each record type can define a sorting field, also known as the codeword segment.
Any record value can display all its meaning only when it is viewed by its path.
No child record value exists independently from the parent record value
Advantages
The data structure of the layered model is simple and clear.
High query efficiency, better performance than the relational model, not lower than the mesh model
The hierarchical data model provides excellent integrity support.
Disadvantages
Multi-to-Multi-contact is not natural
There are many restrictions on insert and delete operations, and the compilation of applications is complicated.
The child node must be queried through the parent node
Hierarchical commands tend to be procedural due to strict structure
Mesh Model
The mesh database system uses the mesh model as the Data Organization Mode
A typical example is the DBTG system:
Also known as CODASYL System
A system solution proposed by DBTG in 1970s
It laid the foundation for the basic concepts, methods, and technologies of the database system.
Actual System
Cullinet Software Inc. Company IDMS
Univac DMS1100
IDS/2 of Honeywell
HP IMAGE
Mesh Model
A set of basic hierarchical connections that meet the following two conditions:
1. allow more than one node to have no parent;
2. A node can have more than one parent.
Representation Method (same as the Hierarchical Data Model)
Solid type: description using record type
Each node represents a record type (entity)
Attribute: Field description
Each record type can contain several fields
Link: indicates the record type (entity) by connecting nodes.
One-to-multiple parent-child relationship
Data Structure of the mesh Data Model
Differences between a mesh model and a hierarchical model
The mesh model allows multiple nodes without parent nodes
The mesh model allows nodes to have multiple parent nodes
The mesh model allows multiple connections (composite connections) between two nodes)
Mesh models can more directly describe the real world
The layered model is actually a special case of the mesh model.
LINK model
The relational database system uses the relational model as the data organization mode.
E. F. Codd, a researcher at the San Jose Research Center at IBM in 1970, first proposed a relational model for the database system.
Almost all new database management systems launched by computer vendors support relational models.
Data Structure of the relational model
Relationship)
A link corresponds to a table.
Tuple)
A row in the table is a tuples.
Attribute)
A column in the table is an attribute, and each attribute is named
Master code (Key)
An Attribute Group in a table that uniquely identifies a tuples.
Domain)
Attribute value range.
Component
A property value in the tuples.
Link Mode
Description of the link
Link name (attribute 1, attribute 2 ,..., Attribute n)
Student (student ID, name, age, gender, department, grade)
Advantages
Based on strict mathematical concepts
Single Concept
Entities and various types of connections are expressed in relationships.
The data retrieval result is also a link.
The access path of the relational model is transparent to users.
Higher Data independence, better security and confidentiality
Simplifies the work of programmers and the establishment of database development.