選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

ALTER EXTERNAL TABLE 範例 - Amazon Redshift

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

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

ALTER EXTERNAL TABLE 範例

下列範例使用位於美國東部 (維吉尼亞北部) 區域 (us-east-1) 的 Amazon S3 儲存貯體, AWS 區域 以及在 中範例為 CREATE TABLE 建立的範例資料表。如需如何搭配外部資料表使用分割區的詳細資訊,請參閱 分割 Redshift Spectrum 外部資料表

以下範例會將 SPECTRUM.SALES 外部資料表的 numRows 資料表屬性設定為 170,000 個資料列。

alter table spectrum.sales set table properties ('numRows'='170000');

以下範例會變更 SPECTRUM.SALES 外部資料表的位置。

alter table spectrum.sales set location 's3://redshift-downloads/tickit/spectrum/sales/';

以下範例會將 SPECTRUM.SALES 外部資料表的格式變更為 Parquet。

alter table spectrum.sales set file format parquet;

以下範例會為 SPECTRUM.SALES_PART 資料表新增一個分割區。

alter table spectrum.sales_part add if not exists partition(saledate='2008-01-01') location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-01/';

以下範例會為 SPECTRUM.SALES_PART 資料表新增三個分割區。

alter table spectrum.sales_part add if not exists partition(saledate='2008-01-01') location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-01/' partition(saledate='2008-02-01') location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-02/' partition(saledate='2008-03-01') location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-03/';

以下範例會修改 SPECTRUM.SALES_PART 以刪除具有 saledate='2008-01-01'' 的分割區。

alter table spectrum.sales_part drop partition(saledate='2008-01-01');

以下範例會為具有 saledate='2008-01-01' 的分割區設定新的 Amazon S3 路徑。

alter table spectrum.sales_part partition(saledate='2008-01-01') set location 's3://redshift-downloads/tickit/spectrum/sales_partition/saledate=2008-01-01/';

下列範例會將 sales_date 的名稱變更為 transaction_date

alter table spectrum.sales rename column sales_date to transaction_date;

下列範例會針對使用最佳化資料列單欄式 (ORC) 格式的外部資料表,將資料欄映射設定為位置映射。

alter table spectrum.orc_example set table properties('orc.schema.resolution'='position');

下列範例會針對使用 ORC 格式的外部資料表,將資料欄映射設定為名稱映射。

alter table spectrum.orc_example set table properties('orc.schema.resolution'='name');
隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。