List Tables
The SHOW TABLES command can be used to obtain a list of all tables within the selected schema.
Query
CREATE TABLE tbl (i INTEGER);
SHOW TABLES;Result
name------ tblSHOW or SHOW ALL TABLES can be used to obtain a list of all tables within all attached databases and schemas.
Query
CREATE TABLE tbl (i INTEGER);
CREATE SCHEMA s1;
CREATE TABLE s1.tbl (v VARCHAR);
SHOW ALL TABLES;Result
database | schema | name | column_names | column_types | temporary----------+--------+------+--------------+--------------+----------- postgres | public | tbl | {i} | {INTEGER} | f postgres | s1 | tbl | {v} | {VARCHAR} | fSHOW TABLES FROM db can be used to list all tables in a given database or schema.
Query
ATTACH 'db.duckdb';
CREATE TABLE db.main_tbl (u VARCHAR);
CREATE SCHEMA db.s1;
CREATE TABLE db.s1.schema_tbl (v VARCHAR);
SHOW TABLES FROM db;Result
name------------ main_tbl schema_tblOr a specific schema.
Query
SHOW TABLES FROM db61.s1;
DETACH IF EXISTS db61;Result
name------------ schema_tblTo view the schema of an individual table, use the DESCRIBE command.
See Also
The SQL-standard information_schema views are also defined. Moreover, SereneDB defines sqlite_master and many PostgreSQL system catalog tables for compatibility with SQLite and PostgreSQL respectively.