

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

# 步驟 1：建立資料庫
<a name="step-1-create-a-database"></a>

首先，您需要在 Athena 中建立資料庫。

**建立 Athena 資料庫**

1. 前往 [https://console.aws.amazon.com/athena/](https://console.aws.amazon.com/athena/home) 開啟 Athena 主控台。

1. 如果這是您第一次造訪您目前 AWS 區域中的 Athena 主控台，請選擇 **Explore the query editor** (探索查詢編輯器) 以開啟查詢編輯器。此外，Athena 會於查詢編輯器中開啟。

1. 選擇 **Edit Settings** (編輯設定) 以在 Amazon S3 中設定查詢結果位置。  
![\[選擇編輯設定。\]](http://docs.aws.amazon.com/zh_tw/athena/latest/ug/images/getting-started-choose-view-settings.png)

1. 對於 **Manage settings** (管理設定)，請執行下列其中一項動作：
   + 在 **Location of query result** (查詢結果的位置) 方塊中，輸入您在 Amazon S3 中為查詢結果建立的儲存貯體路徑。在路徑中加上 `s3://` 作為字首。
   + 選擇 **Browse S3** (瀏覽 S3)，選擇您在目前區域建立的 Amazon S3 儲存貯體，然後選擇 **Choose** (選擇)。  
![\[在 Amazon S3 中指定要從 Athena 接收查詢結果的位置。\]](http://docs.aws.amazon.com/zh_tw/athena/latest/ug/images/getting-started-setting-results-location.png)

1. 選擇**儲存**。

1. 選擇 **Editor** (編輯器) 以切換至查詢編輯器。  
![\[選擇 Editor (編輯器)。\]](http://docs.aws.amazon.com/zh_tw/athena/latest/ug/images/getting-started-choose-editor.png)

1. 在導覽窗格的右側，您可以使用 Athena 查詢編輯器來輸入和執行查詢和陳述式。

1. 若要建立名為 `mydatabase` 的資料庫，請輸入以下 CREATE DATABASE 陳述式。

   ```
   CREATE DATABASE mydatabase
   ```

1. 選擇 **Run** (執行) 或按 **Ctrl\$1ENTER**。

1. 從左側的 **Database** (資料庫) 清單中，選擇 `mydatabase` 設為您目前的資料庫。