这更好,因为性能明智且无错误导致从android中的sqlite中删除表中的所有行。
删除查询或删除表并重新生成表
我是从post
找到的it is more efficient to drop table and re-create it; and yes, You can use "IF EXISTS" in this case
DELETE FROM will cause SQLite to visit individual rows unless those rows have triggers, so it's generally reasonably efficient.
edited after 1 answer post
As the Droping the table using drop table query then internally delete query was used? As in one answer post
答案 0 :(得分:3)
根据sqlite查询,我找到了答案。在sqlite中,他们使用了截断优化,因此当省略“where”子句时,他们删除表并重新创建表,这比删除所有行要快得多。
这是
的链接http://www.sqlite.org/lang_delete.html
http://www.sqlite.org/compile.html#omit_truncate_optimization
答案 1 :(得分:0)
据我所知 DELETE QUERY 是更好的选择。为什么因为Drop表在内部使用删除查询。如果使用Drop查询,则必须重新生成表。这是一个额外的过程。