SHOW TABLES

Description

This statement is used to display all tables in the current db

Syntax:

SHOW TABLES;

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 CelerData 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 CelerData cloud account. 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