PRAGMA table_list
This pragma returns information about the tables and views in the schema, one table per row of output.
PRAGMA table_list; PRAGMA schema.table_list; PRAGMA table_list(table-name);
On the sample database
What PRAGMA table_list returns on the sample database, in SQLite 3.54.1 as built for the browser by sql.js (the first 12 of 17 rows):
| schema | name | type | ncol | wr | strict |
|---|---|---|---|---|---|
| main | lyrics_segments | shadow | 2 | 0 | 0 |
| main | album_lengths | view | 2 | 0 | 0 |
| main | playlist_tracks | table | 3 | 1 | 0 |
| main | lyrics_segdir | shadow | 6 | 0 | 0 |
| main | sqlite_sequence | table | 2 | 0 | 0 |
| main | notes | table | 4 | 0 | 0 |
| main | playlists | table | 3 | 0 | 0 |
| main | genres | table | 2 | 1 | 0 |
| main | artists_archive | table | 3 | 0 | 0 |
| main | sqlite_schema | table | 5 | 0 | 0 |
| main | lyrics_content | shadow | 3 | 0 | 0 |
| main | sales | table | 5 | 0 | 1 |
What the SQLite documentation says
This pragma returns information about the tables and views in the schema, one table per row of output. The table_list pragma first appeared in SQLite version 3.37.0 (2021-11-27). As of its initial release the columns returned by the table_list pragma include those listed below. Future versions of SQLite will probably add additional columns of output.
- schema: the schema in which the table or view appears (for example "main" or "temp").
- name: the name of the table or view.
- type: the type of object - one of "table", "view", "shadow" (for shadow tables), or "virtual" for virtual tables.
- ncol: the number of columns in the table, including generated columns and hidden columns.
- wr: 1 if the table is a WITHOUT ROWID table or 0 if is not.
- strict: 1 if the table is a STRICT table or 0 if it is not.
- Additional columns will likely be added in future releases.
The default behavior is to show all tables in all schemas. If the schema. name appears before the pragma, then only tables in that one schema are shown. If a table-name argument is supplied, then only information about that one table is returned.
From sqlite.org's pragma documentation for SQLite 3.54.1, in the public domain.
← table_info · table_xinfo →