

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 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']
```

## Parameters
<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` 中包含「航班」一詞的所有資料表的名稱**  

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

```
flights_2016
flights_parquet
view_2016_flights_dfw
```

**Example - 顯示 `sampledb` 中以「日誌」結尾的所有資料表的名稱**  

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

```
alb_logs
cloudfront_logs
elb_logs
```