List Tables
The SHOW TABLES command can be used to obtain a list of all tables within the selected schema.
CREATE TABLE tbl (i INTEGER);
SHOW TABLES;
| name |
|---|
| tbl |
SHOW or SHOW ALL TABLES can be used to obtain a list of all tables within all attached databases and schemas.
CREATE TABLE tbl (i INTEGER);
CREATE SCHEMA s1;
CREATE TABLE s1.tbl (v VARCHAR);
SHOW ALL TABLES;
| database | schema | table_name | column_names | column_types | temporary |
|---|---|---|---|---|---|
| memory | main | tbl | [i] | [INTEGER] | false |
| memory | s1 | tbl | [v] | [VARCHAR] | false |
SHOW TABLES FROM db can be used to list all tables in a given database or schema.
ATTACH 'db.db';
CREATE TABLE db.main_tbl (u VARCHAR);
CREATE SCHEMA db.s1;
CREATE TABLE db.s1.schema_tbl (v VARCHAR);
SHOW TABLES FROM db;
| name |
|---|
| main_tbl |
| schema_tbl |
Or a specific schema.
SHOW TABLES FROM db.s1;
| name |
|---|
| schema_tbl |
To view the schema of an individual table, use the DESCRIBE command.
See Also
The SQL-standard information_schema views are also defined. Moreover, Goose defines sqlite_master and many PostgreSQL system catalog tables for compatibility with SQLite and PostgreSQL respectively.