MySQL database from entry to proficiency in the first day of learning

Basic Concepts of Database

Database (DataBase) is a warehouse that organizes, stores and manages data according to the data structure, and is a collection of related data stored together. It mainly has the following advantages:

  • Reduce data redundancy (that is, consider an extra amount from a security point of view, this amount is to ensure that instruments, equipment or a certain work can operate normally under abnormal conditions), and save data storage space
  • High data independence and easy scalability
  • Realize the full sharing of data resources

Database systems

Database system (DataBase System, DBS) is a computer system using database technology, which is composed of database (data), database management system (software), database administrator (personnel), hardware platform (hardware) and software platform (software) A partially constituted operational entity. Among them, the database administrator (DataBase Administered, DBA) is a professional manager who plans, designs, maintains and monitors the database, and plays a very important role in the database management system.

database management system

Database management system (DataBase Management System, DBMS) is an important part of the database system. It is a layer of data management software between users and operations, responsible for data organization, data manipulation, data maintenance and data services in the database. It mainly has the following functions:

  1. Physical construction of data access
    Provide effective access methods and means for physical access and construction of data models
  2. Data manipulation function
    Provides convenience for users to use database data, such as query, insert, modify, delete, etc., as well as simple arithmetic operations and statistics
  3. Data definition function
    Users can easily define objects in the database through the data definition language provided by the database management system
  4. Database operation management
    The database management system uniformly manages the operation and maintenance of the database to ensure data security, integrity, concurrency and system recovery from failures
  5. Database establishment and maintenance function
    The database management system can complete initial data input and conversion, database dump and recovery, database performance monitoring and analysis, etc.

relational database

A relational database is a database that supports the relational model. The relational model consists of three parts: relational data structure, relational operation set and integrity constraints:

1) Relational data structure
In the relational model, the data structure is single, and the entities in the real world and the connections between entities are represented by relations. In fact, the data structure in the relational model is a two-dimensional table 2) Relational operations set Relational operations are divided
into relational
algebra , relational calculus, language (SQL) with dual characteristics of relational algebra and relational calculus
3) Integrity constraints
include entity integrity, referential integrity and user-defined integrity

Common Database Objects

In a MySQL database, entities such as tables, fields, indexes, views, and stored procedures that store data or operate on data are called data objects. The following describes commonly used database objects:

  1. Table
    A table is a database object that contains all the data in a database and consists of rows and columns for organizing and storing data
  2. Field
    Each column in the table is called a field, and the field has its own attributes, such as field type, field size, etc. Among them, the field type is the most important attribute of the field, which determines which data type the field can store. The SQL specification supports five basic field types: character, text, numeric, logical, and datetime
  3. Index
    An index is a single, physical data structure. It is established depending on the table. With it, the database program can find the required data in it without scanning the entire table. 4. The view view
    is a
    table (also called a virtual table) derived from one or more tables. It is a way for users to view the data in the data table. The table includes several defined data listed in the data row, and its structure and data are based on the query of the table
  4. Stored Procedure
    Stored Procedure (Stored Procedure) is a set of SQL statements (including operations such as query, insert, delete, and update) to complete specific functions. After compilation, it is stored in the database on the MySQL server side in the form of a name. Specifies the name of the stored procedure to execute. When this stored procedure is called to execute, these operations will also be executed at the same time

system database

The system database refers to some databases that will be attached after the MySQL server is installed. For example, in the default installation of MySQL, the following databases are created by default:

insert image description here

These databases are called system databases. The system databases record some necessary information, and users cannot directly modify them. A brief introduction to these databases is given below:

  • The information_schema database
    information_schema database is mainly used to store the information of all databases of the MySQL server, such as the name of the database, the table of the database, the access authority, the data type of the database table, the information of the data index, etc.
  • mysql database
    mysql database is the core database of MySQL, mainly responsible for storing database users, authority settings, keywords and other control and management information that MySQL itself needs to use
  • The performance_schema database
    performance_schema database is mainly used to collect database server performance parameters, which can be used to monitor the resource consumption and resources of the server in a lower-level running process
  • sys database.
    All data sources in the sys database come from performance_schema. The goal is to reduce the complexity of performance_schema, so that DBAs can better read the contents of this library, and let DBAs understand the operation of DB faster.

Guess you like

Origin blog.csdn.net/m0_67021058/article/details/130041129