Reference database name in sqlite studio

1.9k Views Asked by At

In Sqlite studio, I usually select the database name from the dropdown before executing a query. However if I want to specify the database name in the SQL itself, something like

  Select * from C:\Folder\DbList\Test.Db \<tableName>.
2

There are 2 best solutions below

0
On

Having several databases open at sametime in SQLite Studio. You can access to all of them from the same SQL query window independentely of the value for db in the dropdown menu that you said.

example of selects from 2 databases

SELECT  title, body
   FROM myDB_1.Notas
   WHERE ROWID< 20
UNION
SELECT  title, content
    FROM my_DB2.texto

Note that score symbol "-" in db name produces errors, so replace it by underscore

1
On

This is not possible. In SQLite, all commands are sent to an opened database, so you must open one before you can execute a command.

The sqlite3 command-line shell has the .open command that does not go to the SQL engine, but in SQLite Studio, this must be done with a menu entry.