DML is primarily for data in database table objects, and general DML is complete:
Inserting new data
Modifying data that has been added
Delete data that you do not need
1. Insert INTO insertion statement
//primary key self-increment can not be inserted, so use NULL insteadInsert into Temp Values(NULL,'Jack', -);//Specify ColumnsInsert into Temp(name, age)Values('Jack', A), with parentheses behind the surface, column names in parentheses, and values that write the value of the specified column name. When omitting column names means inserting all data, note that the order in which the values are inserted and the order of the columns need to be consistent. //set mode, you can also specify the columnInsert into Temp SetId= 7, name= 'Jason';//the foreign key reference of the MySQL foreign key table can be inserted into the data can be null, without reference to the data of the primary table. //inserting data using subqueriesInsert into Temp(name)SelectName fromclasses;//multi-row insertionInsert into Temp Values(NULL,'Jack', A), (NULL,'Jackson', at);
2. Update modification Statement
Update basically completes the modification of the data, you can modify one or more data.
modifying multiple or specified criteria needs to be done with a where condition.
//Modify All DataUpdate Temp SetName= 'Jack2';//The name of all the data will be modified if multiple columns are modified with "," separateUpdate Temp SetName= 'Jack', age= A;//changing the record for the specified condition requires a whereUpdate Temp SetName= 'Jack' whereAge> A;
3. Delete Deletion statement
Delete all of the data in the table, with the condition that you can delete the specified record.
// Delete all data Delete from Temp ; // Delete specified condition data Delete from Temp where > ;
MySQL DML statement (insert update Delete)