A brief introduction to SQL

SQL, short for Structured Query Language, is a standard computer Language used to access and operate databases, including data definition, data manipulation, data Query, and data control. SQL has become the standard Language of RDBMS. Different RDBMSS use different versions of SQL, and these differences are proprietary extensions to different databases.

2, SQL can do:

  1. You can create and manage databases, data tables, stored procedures, views, and more;
  2. New records can be inserted into the database, and can be modified to delete;
  3. Records in the database can be queried;
  4. Transaction control and authority management can be performed on the database.

Third, the classification of SQL language

Divided by function: DDL, DML, DQL, DCL

  1. DDL: Data Definition Language (DDL), which is used to create and delete databases, tables, and views. Include CREATE, ALTER, and DROP.
  2. DML: Date Manipulation Language (DATA Manipulation Language), used to add, delete, and modify records in data tables. These include INSERT, DELETE, and UPDATE;
  3. DCL: Data Control Language, including permission country and transaction management for database objects. The operations include COMMIT, ROLLBACK, and GRANT.
  4. DQL: Data Query Language (DQL). Query is a basic function of a database. SELECT is used to Query records in a Data table.

In DLL, there are two main operations on the database: create and delete.

  1. CREATE DATABASE: CREATE DATABASE name;
  2. DROP DATABASE: DROP DATABASE name;
  3. Show databases;
  4. Display the current working database: select database();
  5. Switch a database: use the database name.