Search notes:

SQLite: PRAGMA table_info

pragma table_info('tab_name') and its select interface display the column information of the table named tab_name.

Return columns

pragma table_info returns 6 columns:
Column name Comment
cid Column id.
name
type data types
notnull Indicates if column has a not null constraint.
dflt_value The default value for the column.
pk 0: column does not participate in a primary key constraint. Otherwise the position of the primary key.
This list can, of course, be found using this very pragma:
.header on
.mode   columns
.width  3 4 4 7 10 2

pragma table_info('pragma_table_info');
--
-- cid  name  type  notnull  dflt_value  pk
-- ---  ----  ----  -------  ----------  --
-- 0    cid         0                    0 
-- 1    name        0                    0 
-- 2    type        0                    0 
-- 3    notn        0                    0 
-- 4    dflt        0                    0 
-- 5    pk          0                    0 
Github repository about-sqlite, path: /sql/pragma/table_info/columns.sql

See also

The SQLite shell command .schema.
pragma table_xinfo
pragmas

Index