SHOW TABLES
Lists all the base tables and views in a database.
Synopsis
SHOW TABLES [IN database_name] ['regular_expression']
Parameters
- [IN database_name]
-
Specifies the
database_name
from which tables will be listed. If omitted, the database from the current context is assumed.Note
SHOW TABLES
may fail ifdatabase_name
uses an unsupported character such as a hyphen. As a workaround, try enclosing the database name in backticks. - ['regular_expression']
-
Filters the list of tables to those that match the
regular_expression
you specify. To indicate any character inAWSDataCatalog
tables, you can use the*
or.*
wildcard expression. For Apache Hive databases, use the.*
wildcard expression. To indicate a choice between characters, use the|
character.
Examples
Example – Show all of the tables in the database sampledb
SHOW TABLES IN sampledb
Results
alb_logs cloudfront_logs elb_logs flights_2016 flights_parquet view_2016_flights_dfw
Example – Show the names of all tables in sampledb
that include the
word "flights"
SHOW TABLES IN sampledb '*flights*'
Results
flights_2016 flights_parquet view_2016_flights_dfw
Example – Show the names of all tables in sampledb
that end in the
word "logs"
SHOW TABLES IN sampledb '*logs'
Results
alb_logs cloudfront_logs elb_logs