Search code examples
pythonsqlrecordssqlitestudio

Clear SQL database


I want to remove all entered data into my SQL database. I am using Python to handle all of the SQL statements from the program - however I did not make a backup of the clean database, and I want to clear all the records and reset primary IDs etc without affecting the structure of the database so it is ready to ship with my code.

I am using Python and SQLiteStudio.

Thanks.


Solution

  • In SQLiteStudio's SQL editor execute this command:

    DELETE FROM table_name;
    

    If you have multiple tables then the command is:

    DELETE FROM table_name_1, table_name_2,...;
    

    Instead of table_name you put the name of your table(s).