The most common operations in a database table are insert, UPDATE, and delete. Here's a look at:
1. Inserting insert
When using a template statement, insert into indicates values.
For example:
Insert has the following points to note:
1) Insert Into-select Inserts the results of the lookup into another table;
2) The data inserted must be the same as the field type in the table, or can be implicitly converted;
2. Updating the update
The update is to update the existing data changes.
Example:
The update has the following points to note:
1) If there is no where to restrict, then the default update all data;
2) Modify the consistency of the operation and database. If several tables have the same field, then after updating a table, verify that the fields in the remaining tables need to be updated. If the update is not updated, it causes the table to be inconsistent. This time the database system introduced the concept of transaction (transaction) to solve this problem.
3. Remove Delete
Use the Delete from-where statement.
Example:
The following are some of the features of delete:
1) Even if all rows have been deleted, the table structure is still there;
2) If there is no WHERE clause, delete deletes all rows;
3) before deleting, it is best to select-where display some, confirm that the display is need to delete, and then execute the DELETE statement;
4) Truncate delete all rows in the table faster than delete. The cost of using truncate is that there is an error that cannot be restored before the change (rollback).
Inserting, updating, deleting tables in the database