One, add data
1. Add data to all fields in the table
(1) Specify all field names in the INSERT statement
(2) INSERT statement does not specify field name: The added value must overwrite all fields and the same order as the fields are defined in the table.
2. Adding data to a specified field in a table
If a field adds a non-null constraint when defined, but does not add a default constraint, the field must be assigned a value when the new record is inserted, or the database system will prompt for an error.
3. Add more than one record at a time
Second, update the data
1. Update updates some data
2. Update all data
Third, delete data
1. Delete Deletes part of the data
2. Delete data from a table using the keyword truncate: can only be used to delete all records in a table.
Note: After you use the TRUNCATE statement to delete data from a table, when you add records to the table again, the default initial value of the auto-increment field starts again at 1, and when you add a record by using the DELETE statement to delete all the records in the table, the value of the field is incremented by 1 when it is deleted.
This article explains the MySQL database add, update and delete data, more relevant content please follow the PHP Chinese web.