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


## 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

csv Example (no headrow):
  1;foo
  2;bar

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