Objective
The front of this series is all about querying select. But the SQL is very extensive, according to the different processing of data can be divided into:
- DML: Full data manipulation Language, as can be seen from the name, DML is the maintenance of the data management language, mainly to deal with the information itself;
- DDL: Full data definition Language, also from the name can be seen, DDL data definition language, mainly used to manipulate libraries, tables, views, indexes, etc., mainly on the operation of data structures;
- DCL: The full Data Control Language, as can be seen from the name, is the language of the controls, mainly used to control data, such as processing data access rights;
- TCL: Full name transaction Control Language, from the names can be seen, is used to deal with transactions;
Each language is divided into a number of actual SQL statements:
type |
SQL Statement |
Dml |
SELECT, INSERT, UPDATE, DELETE |
Ddl |
CREATE, ALTER, DROP, COMMENT |
DCL |
GRANT, REVOKE |
Tcl |
COMMIT, ROLLBACK, SET TRANSACTION |
Additional DDL syntax for inserting data
Grammar:
INSERT INTO TABLE_NAME (column1, column2...columnJ) value (?, ?...?);INSERT INTO TABLE_NAME (column1, column2...columnJ) values (?, ?...?), (?, ?...?), (?, ?...?);
From the above you can see that insert has two ways of writing, single insert and BULK INSERT.
Update data
Grammar:
UPDATE TABLE_NAME SET column1 = ?, column2 = ? [WHERE condition]
You can see that updates can be selected with one or more columns of updates, or a more where condition, optionally updating the specified column of the corresponding row.
Delete data
Grammar
DELETE FROM TABLE_NAME [WHERE condition]
When you delete, you can choose to use the Where condition to specify that the data for the row be deleted, otherwise all data will be deleted
SQL Series (12)--insert Update Delete