更新时间:2023-12-01 13:16:28
方法:1:
PRAGMA writable_schema = 1;
delete from sqlite_master where type = 'table';
PRAGMA writable_schema = 0;
方法:2:
select 'drop table ' || name || ';' from sqlite_master where type = 'table';
此输出是一个脚本,它将为您删除表.对于索引,只需将表替换为索引即可.
The output of this is a script that will drop the tables for you. For indexes, just replace table with index.
您可以在where部分中使用其他子句来限制选择哪些表或索引(例如,对于以"pax_"开头的表或索引,请使用和名称glob'pax _ *'").
You can use other clauses in the where section to limit which tables or indexes are selected (such as "and name glob 'pax_*'" for those starting with "pax_").
您可以在一个简单的bash(或cmd.exe)脚本中将此脚本的创建与运行结合起来,这样就只需要运行一个命令即可.
You could combine the creation of this script with the running of it in a simple bash (or cmd.exe) script so there's only one command to run.
如果您不关心数据库中的任何信息,我认为您可以删除存储在硬盘上的文件,这可能会更快.我从来没有测试过,但是我看不出为什么它不起作用.
If you don't care about any of the information in the DB, I think you can just delete the file it's stored in off the hard disk - that's probably faster. I've never tested this but I can't see why it wouldn't work.
请参见下面的删除所有表"命令链接:
refer the bellow drop all table command link: