tags:

views:

400

answers:

2

Is it possible to dump only part of a database? I have a database containing 250'000 entries. I want to create a second one with a tenth of the data in it...

using

select * from table where id % 10 = 0

and setting

.output out.sql

yields a file that does not have the 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  A: 

Instead of dumping to a 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 the table stuff in New.db.

Stephen Jennings
This is it. Thanks!
kungfoo
A: 

You could use the select offset and limit params if you know which range of rows you want.