summaryrefslogtreecommitdiff
path: root/doc/note/sqlite/sqlite.txt
blob: eeb5aac599d2d65e3dec697c8f3e9b3f6cd8acdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23


## How to merge two DBs with same schema

BEGIN TRANSACTION;
ATTACH 'gugus.db' AS other;
INSERT INTO "Foo" SELECT * FROM "other"."Foo";
INSERT INTO "Bar" SELECT * FROM "other"."Bar";
COMMIT;
DETACH other;


ATTACH 'bekb-2023.db' AS other;
INSERT INTO "Account" SELECT * FROM "other"."Account";
INSERT INTO "Currency" SELECT * FROM "other"."Currency";
INSERT INTO "AccountType" SELECT * FROM "other"."AccountType";
INSERT INTO "Transaction" SELECT * FROM "other"."Transaction";


## import CSV

  sqlite3 foo.db -bail -cmd '.mode csv' -cmd '.separator ;' -cmd '.import foo.csv FooTable'