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
Parameter | Required | Description |
---|---|---|
catalog_name | No | The name of the internal catalog or an external catalog.
|
db_name | No | The 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
- SHOW CATALOGS: Views all catalogs in a StarRocks cluster.
- SHOW DATABASES: Views all databases in the internal catalog or an external catalog.