sqlite3
TLDR
Open or create a database
SYNOPSIS
sqlite3 [options] [database] [sql]
DESCRIPTION
sqlite3 is the command-line interface for SQLite, a self-contained, serverless SQL database engine. SQLite databases are single files that can be easily shared and backed up.
The tool provides both interactive and batch modes. In interactive mode, enter SQL statements ending with semicolons or dot commands for administrative functions. Batch mode processes SQL from arguments or stdin.
SQLite supports most SQL features including transactions, triggers, views, and complex queries. It's embedded in countless applications and is ideal for local storage, testing, and small-scale applications.
PARAMETERS
-csv
Set output mode to CSV-json
Set output mode to JSON-column
Set output mode to column format-header
Include column headers in output-line
Set output mode to one value per line-separator sep
Set field separator for CSV mode-init file
Execute SQL from file at startup-batch
Batch mode; exit on error-readonly
Open database in read-only mode-version
Show version information
DOT COMMANDS
.tables: List all tables
.schema [table]: Show CREATE statements
.headers on|off: Toggle column headers
.mode mode: Set output mode (csv, column, json, line, etc.)
.import file table: Import data from file
.output file: Redirect output to file
.read file: Execute SQL from file
.dump [table]: Dump database as SQL
.exit or .quit: Exit sqlite3
.help: Show all dot commands
CAVEATS
SQLite uses dynamic typing; any column can store any type regardless of declared type. This differs from strict SQL databases.
Concurrent writes are limited—SQLite locks the entire database during writes. For high-concurrency applications, consider client-server databases.
Dot commands are sqlite3-specific, not SQL. They don't work in SQL statements or from application code.
SEE ALSO
mysql(1), psql(1), sqlite-utils(1)


