这在性能方面更可取,并且没有错误导致从 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
最佳答案
根据 sqlite 查询,我找到了答案。在 sqlite 中,他们使用了截断优化,因此当省略“where”子句时,他们删除表并重新创建表,这比删除所有行要快得多。
这是链接
http://www.sqlite.org/lang_delete.html
http://www.sqlite.org/compile.html#omit_truncate_optimization
关于android - 删除所有查询或删除查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7401609/