The composition of the database
data
Data is a symbolic record describing a transaction; including numbers, text, graphics, images, sounds, file records, etc.
Store in a unified format in the form of "records"
surface
Combine different records into tables in rows and columns
used to store specific data
database
It's just a collection of all the different property sheets
A collection of interrelated data stored in an organized manner
database management system DBMS
A database management system (Database Management System, DBMS) is a system software that realizes the effective organization, management and access of database resources. With the support of the operating system, it supports various operations of the user on the database
DBMS main functions
- Database establishment and maintenance functions: including establishment of database structure, data entry and conversion, database dump and recovery, database reorganization and performance monitoring, etc.
- Data definition function: including functions such as defining global data structure, local logical data structure, storage structure, security mode and information format. Ensure that the data stored in the database is correct, valid and consistent, so as to prevent semantically incorrect data from being input or output
- Data manipulation function: including data query statistics and data update
- Database operation management function: This is the core part of the database management system, including concurrency control, access control, internal maintenance of the database and other functions
- Communication function: Communication between DBMS and other software systems, such as Access can exchange data with other Office components
DBMS workflow
- Accept data requests from applications and process requests
- Convert user data requests (high-level instructions) into complex machine codes (low-level instructions)
- Implement operations on the database
- Receive query results from database operations
- Process query results (format conversion)
- Return the processing result to the user
database type
Relational databases: often store characters, strings, numbers, Boolean values, etc.
Non-relational databases: often store pictures, videos, voices, etc.
relational database
Relational database (SQL): often stores characters, strings, values, Boolean values, etc. (stored on disk)
The relational database system is a database system based on the relational model. The data structure of the relational model uses a simple and understandable two-dimensional data table
- Each row is called a record, which is used to describe the information of an object
- Each column is called a field and is used to describe a property of the object
ER relationship diagram
entity
Also known as an instance, it corresponds to an "event" or "thing" that can be distinguished from other objects in the display world, such as bank customers, bank accounts
entity
Also known as an instance, it corresponds to an "event" or "thing" that can be distinguished from other objects in the display world, such as bank customers, bank accounts
entity
Also known as an instance, it corresponds to an "event" or "thing" that can be distinguished from other objects in the display world, such as bank customers, bank accounts
-
advantage:
Easy to maintain: all use the table structure, the format is consistent Ease
of use: sql language is common and can be used for complex queries
Complicated operations: support sql statements, one table and very complex queries between multiple tables can be used -
shortcoming
The reading and writing performance is relatively poor, especially the high-efficiency reading and writing of massive data
. The fixed table structure has poor flexibility.
The requirement for high concurrent reading and writing is poor. For traditional relational data, hard disk reading and writing is a big bottleneck
Database application scenarios
Mysql (Oracle company), Oracle (tax bureau): 12306 user information system
SQL server (Microsoft), sybase: Taobao account system
access (Microsoft office product), informix: China Unicom mobile phone number information system
DB2 (IBM, Guodian), FoxPRO: bank user account system
PostgreSQL: website user information system
non-relational database
Suitable for modeling, defining, and storing data with clear relationships
It can store massive amounts of data, give "big data" to analyze, and screen out valuable parts
- advantage
Flexible format: the format of stored data can be in the form of key, value, document, picture, etc., document form, picture form, etc.
It is flexible to use and has a wide range of application scenarios, while relational databases only support basic types.
Fast speed: nosql can use hard disk or random access memory as a carrier, while relational database can only use hard disk;
high scalability;
low cost: nosql database is easy to deploy and basically is open source software.
- shortcoming
Does not provide sql support, high cost of learning and use;
no transaction processing;
relatively complex data structure, less complex query.