Required SQL statement (4) data deletion and update, SQL statement

Source: Internet
Author: User

Required SQL statement (4) data deletion and update, SQL statement

1. Delete

1) delete records
Delete from table name where id = 'xx'


2) Delete all data and return to the initialization Id field.
Truncate table name


3) differences between delete and truncate
A. truncate enables seeds to return to the initial value.
B. The truncate clause cannot be used.
C. truncate does not involve triggers
D. truncate performance is much higher than delete Performance

2. Update

1) Basic update
Update table name
Set [column name] = 'value'
Where [column name] = 'value'


2) used with replace
-- Replace 'start' with 'in a name over 19 years old'★'.
Update table name
Set name = replace (name, 'start ','★')
Where age> 19

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.