SQLite Commands & Cheat Sheet
This page provides a comprehensive SQLite cheat sheet, offering quick access to essential commands for managing your SQLite databases. Whether you're a beginner or an experienced developer, this resource will help you navigate and utilize SQLite effectively.
Connect to SQLite
Command | Description |
---|---|
sqlite3 <db> |
Connect to a SQLite database file. If the file does not exist, it will be created. |
SQLite CLI Commands
Master the SQLite command-line interface (CLI) with these fundamental commands for database introspection and management.
Command | Description |
---|---|
.databases |
List all databases currently attached to the session. |
.tables |
List all tables in the current database. |
.schema <table> |
Show the SQL schema definition for a specific table. |
.indexes <table> |
List all indexes defined for a given table. |
.show |
Display the current settings and configurations for the SQLite session. |
.help |
Display comprehensive help information for all SQLite commands. |
.shell <command> |
Execute a command in the host operating system's shell. |
.exit |
Quit the SQLite interactive shell. |
Backup and Restore SQLite Databases
Learn how to safeguard your data by backing up and restoring SQLite databases using these crucial commands.
Command | Description |
---|---|
.backup <file> |
Create a full backup of the current database to a specified file. |
.restore <file> |
Restore the current database from a backup file. |
.dump |
Output the entire database as a series of SQL statements. This can be used for creating backups or migrating data. |
For more in-depth information on SQLite, refer to the official documentation: