The PRAGMA statement is a special SQL statement used to modify the operation of the SQLite library or to query the library for internal (non-table) data. The PRAGMA statement is issued using the same interface as other SQLite commands (e.g. SELECT, INSERT) but is different in the following important respects:

The available pragmas fall into four basic categories:


PRAGMA command syntax

pragma-stmt:

syntax diagram pragma-stmt

pragma-value:

syntax diagram pragma-value

A pragma can take either zero or one argument. The argument is may be either in parentheses or it may be separated from the pragma name by an equal sign. The two syntaxes yield identical results. In many pragmas, the argument is a boolean. The boolean can be one of:

1 yes true on
0 no false off

Keyword arguments can optionally appear in quotes. (Example: 'yes' [FALSE].) Some pragmas takes a string literal as their argument. When pragma takes a keyword argument, it will usually also take a numeric equivalent as well. For example, "0" and "no" mean the same thing, as does "1" and "yes". When querying the value of a setting, many pragmas return the number rather than the keyword.

A pragma may have an optional database name before the pragma name. The database name is the name of an ATTACH-ed database. Or it can be "main" or "temp" for the main and the TEMP databases. If the optional database name is omitted, "main" is assumed. In some pragmas, the database name is meaningless and is simply ignored.


Pragmas to modify library operation


Pragmas to query the database schema


Pragmas to query/modify version values


Pragmas to debug the library