Introduction to SQL Statement Syntax

SQL commands are generally divided into DQL, DML, DDL categories:

DQL: data query statement, basically the SELECT query command, used for data query

DML: Abbreviation of Data Manipulation Language, that is, data manipulation language, mainly used for insert, update, delete statements, so it is also divided into INSERT, UPDATE, DELETE three statements

DDL: Abbreviation of Data Definition Language, that is, data definition language, mainly used to create, delete, and modify database object languages ​​such as tables and indexes

 

SQL statement: TRUNCATE TABLE

The purpose of the statement is to clear the table contents. Compared with the statement delete table, both of them have the function of clearing the contents of the data table. But from the execution result, although the two implement the same function, the principle of implementation is different.

TRUNCATE TABLE is a DDL statement, which is equivalent to directly discarding the contents of the original table by redefining a new table, so the execution is very fast, but DELETE TABLE is a DML statement. It can be considered that DELETE deletes the data one by one. Delete many rows of data, it will be slower.

If you want to clean up the data in table A, you can use the command: TRUNCATE TABLE A

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324613768&siteId=291194637