答案 0 :(得分:3)
PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type = 'table' AND name NOT IN ('X', 'Y', 'Z');
PRAGMA writable_schema = 0;
VACUUM;
或者,获取DDL:
SELECT 'DROP TABLE ' || name || ';' FROM sqlite_master
WHERE type = 'table' AND name NOT IN ('X', 'Y', 'Z');