是否可以只转储数据库的一部分?我有一个包含 250'000 个条目的数据库。我想创建第二个,其中包含十分之一的数据...
使用
select * from table where id % 10 = 0
和设置
.output out.sql
生成的文件没有以与使用时相同的方式编码的二进制数据
.dump
dump -> the binary data gets encoded as hex bytes
other way -> it gets encoded as some weird string
最佳答案
您可以直接写入一个新数据库,而不是转储到文件中:
ATTACH DATABASE New.db AS new;
CREATE TABLE new.stuff AS (SELECT * FROM table WHERE id % 10 = 0);
这应该在 New.db
中创建表 stuff
。
关于sqlite - 仅转储 sqlite 数据库的一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/566009/