Q:

Java-Sqlite Truncate all Database tables

How to Truncate All Tables in Sqlite Database using Java?
I know i can do this
{
    ...
     String table_name1 = "Delete From table_name1";
     String table_name2 = "Delete From table_name2";
     String table_name3 = "Delete From table_name3";
     String table_name4 = "Delete From table_name4";
     String table_name5 = "Delete From table_name5";
     stmt.executeUpdate(table_name1);
    ...
 }

I can execute all these Strings to do the task but it increases the Lines of Code.
Is there a way to Truncate all tables in a Database with a single command, without separately typing there names?

A:

There's no TRUNCATE in sqlite. You can use DELETE FROM <tablename> to delete all table contents. You'll need to do that separately for each table.
However, if you're interested in removing all data, consider just deleting the database file and creating a new one.

