Open a database file
Start the sqlite3 shell with a file-backed database.
sqlite3 app.dbCreates the file if it does not exist and opens an interactive shell session.
sqlite3 shell commands for opening databases, inspecting schema, formatting output, importing CSV, and scripting common interactive workflows.
Start sqlite3, open files, inspect databases, and discover schema objects.
Start the sqlite3 shell with a file-backed database.
sqlite3 app.dbCreates the file if it does not exist and opens an interactive shell session.
Start a temporary database that lives only for the session.
sqlite3 :memory:Useful for quick experiments, demos, and throwaway SQL tests.
Show the main database and any attached files.
.databasesDisplays the database aliases and file paths known to the current connection.
.tablesFast way to discover tables and virtual tables from the shell.
.schemaGood for inspecting tables, indexes, triggers, and views.
Print the CREATE statement for a specific object.
.schema usersLimits output to matching objects, which is easier to read in larger databases.
Include internal objects useful for advanced debugging.
.fullschemaHelpful when investigating query-planner behavior and generated internal objects.
.helpUseful when working on a new machine or less-familiar sqlite3 version.
Format results, run scripts, import CSV, and dump databases.
.headers onOften paired with `.mode column` for human-readable query results.
.mode columnGreat for interactive browsing in a terminal.
.mode csvUseful before redirecting or writing query output to a file.
.import ./users.csv usersMake sure the target table exists first or use a staging table for cleanup.
.read ./schema.sqlUseful for schema initialization, migrations, or repeatable demos.
.dumpHelpful for backups, migrations, and reproducible fixtures.
Send one result set to a file without changing subsequent output.
.once users.csvCombine with `.mode csv` and a `SELECT` statement to export a query result.
Use the shell recovery command.
.recoverCan salvage data from a corrupt database into SQL output for rebuilding.