Basic understanding of Mysql database

Basic concept

  • SQL
    SQL is a high-level language based on the database, which implements various operations on data, a standard for relational databases, that is, the SQL language is common to all protocol standards.

  • DB (DataBase)
    database is a collection of data, stored in the file system, in the form of files

  • DBMS (DataBase Management System)
    database management system is what we often call mysql, oracle, db2, etc.

Type of database (DBMS) (common)

  • Relational database
    Create multiple tables in the form of two-dimensional tables to create a database
    Insert picture description here

You can query Zhang San's teacher and grades through association

Development of relational database composition structure

The purpose of the structure is to find the required data quickly and easily

 - 层次结构
 	- 按照一层一层的分级,找数据避免就要一层一层走,导致需要走没必要的层级 
 - 网状结构
 	- 对于层次结构做了优化,数据上下左右4层都可以走,但是效果还是不好,还是要走没有必要的层
 - 关系结构(目前都是基于关系结构)
 	- 也就是基于二维表结构,就是我们使用的execl表格,这个好处就完全需要找什么,就找什么
  • Non-relational databases
    Non-relational databases are stored in key-value pairs, and the structure is not fixed. Each tuple can have different fields
    Insert picture description here

5 categories of sql language

  • DQL (Data Query Language)-Select query statement does not have a submission problem. (Data Query Language)
  • DML (Data Manipulation Language)-Insert, Update, and Delete statements require Commit to be submitted. (DataManipulation Language)
  • DDL (Data Definition Language)-Create, Alter, and Drop statements are automatically submitted without using Commit. (Data Definition Language)
  • DTL (Transaction Control Language)-Commit, Rollback transaction commit and rollback statements. (Transaction Control Language)
  • DCL (Data Control Language)-Grant, Revoke grant and revoke permission statements. (Data Control Language)

Adding, deleting, modifying and checking is currently the most commonly used, and it is necessary to know. It is the operation of data, including DQL and DML.
DDL is for table structure operations, not data. All are not commonly used, because the table is already before the data. A well-defined, uncommon modification
DTL is one or a group of sql statements forming an execution unit, this execution unit is either all executed or not executed at all, to maintain the integrity of the data
DCL is used for the allocation and recovery of user permissions

Note: database (DBMS) operation commands and sql statements need to be distinguished

Operation command: show databases; create database ABC; ues ABC; etc.
SQL statement: CREATE TABLE table_name (column_name column_type);
Distinction: SQL is for table operations

Guess you like

Origin blog.csdn.net/yangshihuz/article/details/108822138