Data management of database series (delete data)

Source: Internet
Author: User

Delete data using the Delete table statement


DELETE from < table name > [WHERE < update condition;]

DELETE  from WHERE Bookcode='981267'
Issue: You cannot delete data rows that are referenced by primary key values when you use Delete to delete data.

To delete data using the TRUNCATE TABLE statement

Truncate Table < name >
Attention:
1. Truncate table Deletes only the rows of data in the table and does not delete the tables structure and various constraints.
2. Truncate table cannot delete a data table that has a referential relationship.

Truncate Table Authors -- equivalent to Delete  from Authors

The difference between Delete and truncate


Delete deleted data can be recovered from the log file
Truncate table deleted data cannot be recovered

When delete is deleted, the identity column values retain the maximum value in the original use
When Truncate table is deleted, the identity column reverts to the identity seed value that was originally set

Delete Deletes data when a record is deleted.
Truncate table when you delete data, it is deleted as a data page.

Data management of database series (delete data)

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.