By stefan.at.wpf


2012-09-28 20:58:47 8 Comments

Using sqlite3 on Linux, how can one work with multiple databases?

I'd like to do something like the following in database 1?

sqlite3 database1.db
insert into database1.mytable values (select * from database2.mytable) 

How do I write the SELECT query for database2 above?

1 comments

@CL. 2012-09-29 14:36:42

(reposting swasheck's comment as reply)

sqlite3 database1.db
> ATTACH DATABASE 'database2.db' AS database2;
> INSERT INTO mytable SELECT * FROM database2.mytable;

Related Questions

Sponsored Content

2 Answered Questions

[SOLVED] Directly import a csv gzip'ed file into SQLite 3

  • 2016-02-07 15:49:53
  • paulperry
  • 2767 View
  • 5 Score
  • 2 Answer
  • Tags:   import sqlite csv

2 Answered Questions

[SOLVED] Looping over column names in SQLite and running a command for each column name

  • 2019-06-01 16:27:58
  • Faheem Mitha
  • 722 View
  • 1 Score
  • 2 Answer
  • Tags:   sqlite

1 Answered Questions

[SOLVED] What is the correct way to select rows from either side of a bridge table?

  • 2019-06-08 04:26:02
  • Graham H
  • 302 View
  • 0 Score
  • 1 Answer
  • Tags:   join sqlite

1 Answered Questions

[SOLVED] Multiple concurrent connections to same large SQLite file on a network share

  • 2019-04-10 14:05:39
  • dumbledad
  • 981 View
  • 1 Score
  • 1 Answer
  • Tags:   sqlite

1 Answered Questions

[SOLVED] Select column from ALL tables

  • 2011-11-03 13:36:04
  • zetah
  • 9854 View
  • 1 Score
  • 1 Answer
  • Tags:   sqlite

1 Answered Questions

[SOLVED] Unexpected behavior of foreign keys

1 Answered Questions

[SOLVED] Simplifying/Improving inner join (self joining a table)

  • 2016-11-16 12:28:17
  • Axel
  • 757 View
  • 3 Score
  • 1 Answer
  • Tags:   sqlite

2 Answered Questions

[SOLVED] How to optimize query

1 Answered Questions

Sponsored Content