Skip to content

Instantly share code, notes, and snippets.

@Ikhiloya
Created November 2, 2018 10:15
Show Gist options
  • Save Ikhiloya/6cacde678f80d85aed35c618c07d98f3 to your computer and use it in GitHub Desktop.
Save Ikhiloya/6cacde678f80d85aed35c618c07d98f3 to your computer and use it in GitHub Desktop.
Delete all records from a table in SQL
delete and truncate :
delete from mytable
This will delete all the content of the table, not reseting the autoincremental id, this process is very slow. If you want to delete specific records append a where clause at the end.
truncate myTable
This will reset the table i.e. all the auto incremental fields will be reset. Its a DDL and its very fast. You cannot delete any specific record through truncate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment