MySQL Basics One [Database Basics]

One, the advantages of the database

Advantages of the database

    1. Persist data to local

    2. Structured query can be realized, which is convenient for management

2. Related concepts

    1. DB: database, a container for storing a group of organized data

    2. DBMS: database management system, also known as database software (product), used to manage the data in the DB

    3. SQL: Structured query language, a language used to communicate with DBMS

Advantages of SQL:

1. It is not a language proprietary to a particular database vendor, almost all DBMS support SQL.

2. Simple and easy to learn.

3. Although simple, it is actually a powerful language. Using its language elements flexibly, it can perform very complex and advanced database operations. 

 

Three, the characteristics of database storage data

1. Put the data in the table, and then put the table in the library.

2. There can be multiple tables in a database, and each table has a unique name to identify itself. The table name is unique.

3. The table has some characteristics, which define how the data is stored in the table, similar to the "class" design in java.

4. The table is composed of columns, which we also call fields. All tables are composed of one or more columns, each column is similar to "attributes" in java

5. The data in the table is stored in rows, and each row is similar to the "object" in java.

 

Four, SQL language classification

1. DML (Data Manipulation Language): data manipulation statements, used to add, delete, modify, query database records, and check data integrity

DML is used to query and modify data records, including the following SQL statements:

INSERT: Add data to the database

UPDATE: Modify the data in the database

DELETE: delete data in the database

SELECT: select (query) data

SELECT is the foundation of the SQL language and the most important.

 

2. DDL (Data Definition Language): data definition statements, used to create, modify, and delete libraries and tables.

DDL is used to define the structure of the database, such as creating, modifying or deleting database objects, including the following SQL statements:

CREATE TABLE: Create a database table

ALTER TABLE: change the table structure, add, delete, modify column length

DROP TABLE: delete the table

CREATE INDEX: Create an index on the table

DROP INDEX: delete index

3. DCL (Data Control Language): data control statement, used to define the user's access authority and security level.

DCL is used to control database access, including the following SQL statements:

GRANT: Grant access

REVOKE: revoke access

COMMIT: Commit transaction processing

ROLLBACK: Transaction processing rollback

SAVEPOINT: Set save point

LOCK: lock a specific part of the database

4. Data query language DQL

The basic structure of the data query language DQL is a query block composed of SELECT clause, FROM clause, and WHERE clause:

SELECT <field name table>


FROM <table or view name>


WHERE <query condition>

 

Guess you like

Origin blog.csdn.net/Kukeoo/article/details/114193611