I'm using the SQLite Command Line Shell. As documented, I can open a database by supplying it as an argument to the executable:
sqlite3 data.db
I cannot figure out how to open a database file from within the tool after having invoked it without supplying the file as a command-line argument (if I, say, double-click sqlite3.exe in Windows).
What is the command within the SQLite shell tool to specify a database file?
Start the sqlite3 program by typing "sqlite3" at the command prompt, optionally followed by the name the file that holds the SQLite database (or ZIP archive). If the named file does not exist, a new database file with the given name will be created automatically.
To access a specific database, type the following command at the mysql> prompt, replacing dbname with the name of the database that you want to access: Copy use dbname; Make sure you do not forget the semicolon at the end of the statement. After you access a database, you can run SQL queries, list tables, and so on.
How to open a DB file. Many types of DB files are not meant to be opened by users. However, if your DB file is a SQLite database, you can open it and view the data it contains with SQLite Database Browser.
You can attach one and even more databases and work with it in the same way like using sqlite dbname.db
sqlite3 : sqlite> attach "mydb.sqlite" as db1;
and u can see all attached databases with .databases
where in normal way the main is used for the command-line db
.databases seq name file --- --------------- ---------------------------------------------------------- 0 main 1 temp 2 ttt c:\home\user\gg.ite
I think the simplest way to just open a single database and start querying is:
sqlite> .open "test.db" sqlite> SELECT * FROM table_name ... ;
Notice: This works only for versions 3.8.2+
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With