Cheatsheet: SQLite
Last updated 2026-09-22
SQLite Specific Commands
List all tables in the database
Get schema of a table
List all views in the database
Analyze a query
Display a low-level description of how SQLite will execute the SELECT statement
Enable foreign key support
Set journal mode to Write-Ahead Logging (WAL)
Set cache size
Set synchronous mode to FULL
Basic Commands
Create a new table
Insert data into a table
Select data from a table
Table Modifications
Add a new column to a table
Delete a table
Update data in a table
Delete data from a table
Advanced Queries
Select data with a pattern
Group data by a column and count occurrences
Perform an inner join between two tables
Upsert, typing, and CLI dot-commands
Insert a row, or update it on a unique-constraint conflict (upsert)
Insert a row, silently skipping it if the unique constraint conflicts
Check the actual stored type of a value (SQLite uses dynamic typing/type affinity, not strict column types)
List all tables and views (sqlite3 CLI dot-command, not SQL)
Print the CREATE statement for a specific table (sqlite3 CLI dot-command)
Back up a live database to a new file (safe copy, run from the shell)
Export the database as a portable SQL script (run from the shell)