Good day.

Tell me how in Android SQLite delete all records from the table?

1 answer 1

You can try this:

 db.delete("TABLE_NAME", null, null); 

be careful with quotes.

Well, or so:

 /** * Remove all users and groups from database. */ public void removeAll() { // db.delete(String tableName, String whereClause, String[] whereArgs); // If whereClause is null, it will delete all rows. SQLiteDatabase db = helper.getWritableDatabase(); // helper is object extends SQLiteOpenHelper db.delete(DatabaseHelper.TAB_USERS, null, null); db.delete(DatabaseHelper.TAB_USERS_GROUP, null, null); } 
  • What is the difference between the first and second options, apart from specifying different table names? - pavlofff
  • essentially nothing, the first is the second method is a clear example - elik