Skip to main content
Version: Latest-3.2

SHOW TABLES

Description

Displays all tables in a StarRocks database or a database in an external data source, for example, Hive, Iceberg, Hudi, or Delta Lake.

NOTE

To view tables in an external data source, you must have the USAGE privilege on the external catalog that corresponds to that data source.

Syntax

SHOW TABLES [FROM <catalog_name>.<db_name>]

Parameters

ParameterRequiredDescription
catalog_nameNoThe name of the internal catalog or an external catalog.
  • If you do not specify this parameter or set it to default_catalog, tables in StarRocks databases are returned.
  • If you set this parameter to the name of an external catalog, tables in databases of an external data source are returned.
You can run SHOW CATALOGS to view internal and external catalogs.
db_nameNoThe database name. If not specified, the current database is used by default.

Examples

Example 1: View tables in database example_db of the default_catalog after connecting to the StarRocks cluster. The following two statements are equivalent.

show tables from example_db;
+----------------------------+
| Tables_in_example_db |
+----------------------------+
| depts |
| depts_par |
| emps |
| emps2 |
+----------------------------+

show tables from default_catalog.example_db;
+----------------------------+
| Tables_in_example_db |
+----------------------------+
| depts |
| depts_par |
| emps |
| emps2 |
+----------------------------+

Example 2: View tables in the current database example_db after connecting to this database.

show tables;
+----------------------------+
| Tables_in_example_db |
+----------------------------+
| depts |
| depts_par |
| emps |
| emps2 |
+----------------------------+

Example 2: View tables in database hudi_db of the external catalog hudi_catalog.

show tables from hudi_catalog.hudi_db;
+----------------------------+
| Tables_in_hudi_db |
+----------------------------+
| hudi_sync_mor |
| hudi_table1 |
+----------------------------+

Alternatively, you can run SET CATALOG to switch to the external catalog hudi_catalog and then run SHOW TABLES FROM hudi_db;.

References