

# SHOW TABLES
<a name="show-tables"></a>

列出数据库中的所有基本表和视图。

**注意**  
在 [GetQueryExecution](https://docs.aws.amazon.com/athena/latest/APIReference/API_GetQueryExecution.html) API 操作中，`SHOW TABLES` 的 [StatementType](https://docs.aws.amazon.com/athena/latest/APIReference/API_QueryExecution.html#athena-Type-QueryExecution-StatementType) 参数被归类为 `UTILITY`，而不是 `DDL`。

## 摘要
<a name="synopsis"></a>

```
SHOW TABLES [IN database_name] ['regular_expression']
```

## 参数
<a name="parameters"></a>

**[IN database\_name]**  
指定将列出其表的 `database_name`。如果省略，则会采用当前上下文中的数据库。  
如果 `database_name` 使用[不支持的字符](tables-databases-columns-names.md)（比如连字符），则 `SHOW TABLES` 可能失败。作为一种解决方法，请尝试用反引号将数据库名称括起来。

**['regular\_expression']**  
从表的列表中筛选出那些符合您指定的 `regular_expression` 的表。要指示 `AWSDataCatalog` 表中的任何字符，您可以使用 `*` 或者 `.*` 通配符表达式。对于 Apache Hive 数据库，请使用 `.*` 通配符表达式。要指示字符之间的选择，请使用 `|` 字符。

## 示例
<a name="examples"></a>

**Example – 显示数据库 `sampledb` 中的所有表**  

```
SHOW TABLES IN sampledb
```
`Results`  

```
alb_logs
cloudfront_logs
elb_logs
flights_2016
flights_parquet
view_2016_flights_dfw
```

**Example – 显示 `sampledb` 中包含单词“flights”的所有表的名称**  

```
SHOW TABLES IN sampledb '*flights*'
```
`Results`  

```
flights_2016
flights_parquet
view_2016_flights_dfw
```

**Example – 显示 `sampledb` 中以单词“log”结尾的所有表的名称**  

```
SHOW TABLES IN sampledb '*logs'
```
`Results`  

```
alb_logs
cloudfront_logs
elb_logs
```