

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

# 將陣列轉換為字串
<a name="converting-arrays-to-strings"></a>

若要將陣列為單一字串，請使用 `array_join` 函數。以下個別範例會建立名為 `dataset` 的資料表，其中包含名為 `words` 的別名陣列。查詢會使用 `array_join` 讓陣列元素加入 `words`、以空格分隔元素，然後在名為 `welcome_msg` 的別名資料欄中傳回產生的字串。

```
WITH
dataset AS (
  SELECT ARRAY ['hello', 'amazon', 'athena'] AS words
)
SELECT array_join(words, ' ') AS welcome_msg
FROM dataset
```

此查詢會傳回：

```
+---------------------+
| welcome_msg         |
+---------------------+
| hello amazon athena |
+---------------------+
```