SQL: After all the data in the table has been deleted, it is incremented starting from 1 when re-inserting

Source: Internet
Author: User

The database is set up with the self-add column , sometimes need to clear the database from the new input data .< Span lang= "ZH-CN" the most common practice is to use sql statement " Delete  indicates the name ", But when you insert the data again , you'll find that the self-increment column starts with the next value of the last deleted data's maximum value. ,1. is there a feeling , feeling quite distressed

Now there is a simple brute force method that lets you delete data , and when you insert the record again , the self- increment column starts at 1 .

Directly from the table, will need to increment the field to modify, the self-increment this option to cancel, and then save, and then save the field again after the custom, this field will be re-increment from the 1 start:

  

 

Above

Emd

SQL: After all the data in the table has been deleted, it is incremented starting from 1 when re-inserting

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.