PRAGMA table_info
This pragma returns one row for each normal column in the named table.
PRAGMA schema.table_info(table-name);
On the sample database
What PRAGMA table_info(tracks) returns on the sample database, in SQLite 3.54.1 as built for the browser by sql.js:
| cid | name | type | notnull | dflt_value | pk |
|---|---|---|---|---|---|
| 0 | id | INTEGER | 0 | NULL | 1 |
| 1 | album_id | INTEGER | 1 | NULL | 0 |
| 2 | name | TEXT | 1 | NULL | 0 |
| 3 | ms | INTEGER | 0 | NULL | 0 |
| 4 | bytes | INTEGER | 0 | NULL | 0 |
| 5 | price | REAL | 0 | NULL | 0 |
What the SQLite documentation says
This pragma returns one row for each normal column in the named table. Columns in the result set include: "name" (its name); "type" (data type if given, else ''); "notnull" (whether or not the column can be NULL); "dflt_value" (the default value for the column); and "pk" (either zero for columns that are not part of the primary key, or the 1-based index of the column within the primary key).
The "cid" column should not be taken to mean more than "rank within the current result set".
The table named in the table_info pragma can also be a view.
This pragma does not show information about generated columns or hidden columns. Use PRAGMA table_xinfo to get a more complete list of columns that includes generated and hidden columns.
From sqlite.org's pragma documentation for SQLite 3.54.1, in the public domain.
← synchronous · table_list →