Dump only parts of sqlite database

Is it possible to reset only part of the database? I have a database containing 250,000 records. I want to create the second with a tenth of the data in it ...

using

select * from table where id % 10 = 0

and installation

.output out.sql

outputs a file that does not have binary data encoded in the same way as when using

.dump

dump -> the binary data gets encoded as hex bytes
other way -> it gets encoded as some weird string
+3
source share
2 answers

Instead of dumping the file, you can directly write a new database:

ATTACH DATABASE New.db AS new;
CREATE TABLE new.stuff AS (SELECT * FROM table WHERE id % 10 = 0);

This should create a table stuffin New.db.

+5
source

You can use selection bias and limit options if you know what range of rows you need.

0
source

Source: https://habr.com/ru/post/1703502/


All Articles