Skip to content

Instantly share code, notes, and snippets.

@cfmeyers
cfmeyers / SQLite-copy-rows-from-one-table-to-another-when-number-of-columns-differ.md
Created August 26, 2013 23:46
SQLite: load rows from one table into another table with differing numbers of columns

#SQLite: load rows from one table into another table with differing numbers of columns

####Suppose I have two tables, both called nations, one from an old database (old.nations) and the other from the current database (nations):

####New table

CREATE TABLE nations (
    id INTEGER NOT NULL,
    name VARCHAR,
 thumb_id INTEGER,
@cfmeyers
cfmeyers / SQLite-transfer-rows-between-databases.md
Created August 26, 2013 22:44
SQLite: moving rows from one SQLite database to another SQLite database

##Connecting two SQLite databases together ###Situation: want to add rows from database A to a table in database B (both in same directory)

sqlite3 B.db
sqlite> ATTACH 'A.db' as A;