SQLite 3 cheatsheet

SQLite 3: Opening and leaving

6 common SQLite 3 tasks.

Check the SQLite version

Print the version of the sqlite3 shell.

sqlite3 --version

Open a database

Open a database file, creating it if it does not exist.

sqlite3 app.db

Run a query from the shell

Run one statement and exit.

sqlite3 app.db "SELECT COUNT(*) FROM users;"

Open another database

Switch to a different database file from inside the shell.

.open other.db

List dot-commands

Show every shell command.

.help

Quit the shell

Leave the sqlite3 shell and return to your terminal.

.quit

Was this page helpful?