1. Add data
1. Add data for all fields in the table
(1) Specify all field names in the insert statement
(2) The insert statement does not specify a field name: the added value must cover all fields and be the same as the field The same order as defined in the table.
2. Add data to the specified field of the table
If a field is defined with a non-null constraint added , but no default constraint is added, then the field must be assigned a value when inserting a new record, otherwise the database system will prompt an error.
3. Add multiple records at the same time
## 2. Update data 1. Update some data##2. Update all data
3. Delete data
1. Delete delete part of the data
2. Use the keyword truncate to delete data in the table: it can only be used to delete all records in the table.
Note: After using the truncate statement to delete the data in the table, when adding records to the table again, the default initial value of the automatically increased field will start from 1 again, while using delete After the statement deletes all records in the table, when adding records again, the value of the automatically increased field is the maximum value of the field when deleted plus 1.
This article explains adding, updating and deleting data in MySQL database, more For related content, please pay attention to php Chinese website.
Related recommendations:
$Selector--how to encapsulate DOM into jquery objectsNative js componentization Develop simple carousel chart example codecss3 animated navigation bar 3DThe above is the detailed content of Add, update and delete data in MySQL database -. For more information, please follow other related articles on the PHP Chinese website!