Skip to content

Instantly share code, notes, and snippets.

@irazasyed
Last active August 10, 2025 20:15
Show Gist options
  • Select an option

  • Save irazasyed/4253470 to your computer and use it in GitHub Desktop.

Select an option

Save irazasyed/4253470 to your computer and use it in GitHub Desktop.

Revisions

  1. Syed I.R renamed this gist Jun 9, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. Syed I.R created this gist Dec 10, 2012.
    6 changes: 6 additions & 0 deletions gistfile1.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    -- your_table: The table to modify
    -- id: The id field/column to reset

    SET @num := 0;
    UPDATE your_table SET id = @num := (@num+1);
    ALTER TABLE your_table AUTO_INCREMENT =1;