SQL Learning Summary (5)--sql Database modification Technology

Source: Internet
Author: User
Tags one table

5.1 Data Insertion

Insert into table name (field name, field name,...) Values (field value, field value,...)

5.2 Data Update

Update tablename Set columnname1=value1 [, columnname2=value2 ...] [Where Condition]

Note: One can only change the data in one table; The new value of the column can be either a specified constant or an expression, or it can be data from another table, and if not, all records for the entire table are modified.

5.3 Data Deletion

Delete from TableName [Where condition]

Note: You can only delete data from one table at a time; Delete Deletes only the records in the table, does not delete the table; Delete cannot delete the values of individual columns, but instead deletes the entire record, and removes all records from the entire table if no conditions are added.

Delete data records from the entire table:

Delete from worker backup truncate table worker backup

Note: Delete actually performs a delete operation on each record in the table, and the database executes all tasks that are likely to occur, such as all tasks such as triggers; the TRUNCATE statement deletes all records at once, ignoring the trigger, faster than delete. However, truncate does not handle other events caused by the deletion, which can create a database integrity problem, and it is best to use Delete for tables that have dependencies.

SQL Learning Summary (5)--sql Database modification Technology

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.