<>DML Common commands

* insert into
* update
* delete
<> insert data insert into

* Mode 1 ( Not recommended ) insert into Table name values ( value 1, value 2 , ....);
PS: You cannot see from the command line what the inserted field is , Unable to determine the number of inserted data , Excessive dependence and table structure order of database
When inserting , The order of values must be exactly the same as the order of the table structure , And the number is the same

* Mode 2 ( recommend ) insert into Table name ( field 1, field 2, ...) values ( value 1, value 2 , ...);
<> Batch insert
insert into Table name ( field 1, field 2, ...) value ( value 1, value 2 , ...) , ( value 1, value 2 , ...) , ( value 1, value 2
, ...) , ( value 1, value 2 , ...) , ( value 1, value 2 , ...) , ( value 1, value 2 , ...) ... ;
PS: When inserting , value and values Can be set data

values Suitable for Insertion of single record , The speed is relatively fast
value Suitable for Batch insert , The speed is relatively fast

<> Data update update

It is based on the original data , Changes the values corresponding to some fields of existing data , There will be no new record
-- Full table update ( Not recommended ) update surface set field 1 = value 1 , field 2= value 2 , ... ; -- Update the data according to certain conditions ( recommend )
update surface set field 1 = value 1 , field 2= value 2 , ... where condition ;
<> Delete data delete
-- Delete all tables ( Not recommended ) delete from surface ; -- Conditional deletion ( recommend ) delete from surface where condition ;
<> Delete all tables

* delete from surface ; ( Not recommended )
* truncate table surface ; ( recommend )

Technology