SQLite 3 cheatsheet

SQLite 3: Inspecting the database

7 common SQLite 3 tasks.

List tables

Show the tables in the database.

.tables

Show a table's definition

Print the CREATE statements for a table and its indexes.

.schema users

Show the whole schema

Print the CREATE statements for everything.

.schema

List a table's indexes

Show the indexes on a table.

.indexes users

List a table's columns

Show column names, types and keys with a pragma.

PRAGMA table_info(users);

List a table's foreign keys

Show the foreign keys declared on a table.

PRAGMA foreign_key_list(orders);

List attached databases

Show the databases and files in use.

.databases

Was this page helpful?