1. insert a new recordinto the table using the INSERT statement, with the following syntax: INSERT into table name [( field List )] values(Value list).
2. Update the operation and character set using the SET statement, for example setcharacter_set_client =latin1\gbk\utf8;
3. Delete the table record using the DELETE statement, for example delete from table name where conditional expression;
4, Use the insert statement to bulk insert multiple records into a table at once, with the statement: insert into ), (value list 2 n
5, Use the insert...select insert result set, Syntax Insertinto [( 1)] Select (field name 2 source table where conditional expression; For example, Create Table statement responsible for quickly creating a new Student table, And the structure of the table and the student Student table structure is the same. insert statement will students Student All records in table are inserted new_student select statement responsible for querying new_student all records of the table, execution results are as follows:
Create tablene_student like student;
Insert intonew_student select * from student;
Select * Fromnew student;
6. insert new record with replace, there are three kinds of statement format:
syntax format 1:replace into table name [(Field list name)]values(Value list)
syntax Format 2:replace [into] target table name [( field List 1)]
Select(Field List name 2)from source table where conditional expression
Syntax format 1, Syntax format 2 is similar to the syntax format of an INSERT statement.
syntax Format 3:
Replace [into] table name
Set field 1= value 1, field 2= value 2
statement Format 3 is similar to the syntax format of the UPDATE statement.
The Replace statement is basically the same as the INSERT statement, except that when you use the Replace statement to insert a new record into a table, the new record's primary key value or uniqueness constraint has the same field value as the old record. The record is deleted first (note: The old record cannot be violated by the foreign KEY constraint), and then the new record is inserted. The biggest benefit of using replace is that you can combine the delete and insert to form an atomic operation so that the delete operation does not have to be associated with the insert The operation is placed in a transaction.