Skip to content

Instantly share code, notes, and snippets.

@Ikhiloya
Created November 2, 2018 10:15
Show Gist options
  • Save Ikhiloya/48b73391588f82f8f8803b9c3989607e to your computer and use it in GitHub Desktop.
Save Ikhiloya/48b73391588f82f8f8803b9c3989607e 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