tencent cloud

Data Lake Compute

ALTER TABLE ADD COLUMN AFTER/FIRST

Download
Focus Mode
Font Size
Last updated: 2024-08-07 17:15:16

Description

Supported engines: Presto and SparkSQL
Applicable table: Native Iceberg tables and external tables
Purpose: Add column to data table.

Standard Statement

ALTER TABLE table_name ADD COLUMN column_name1 column_type [COMMENT col_comment] [FIRST|AFTER column_name2]

Parameter

table_name: Name of the target table
column_name1: Column to be added
column_type: Type of the column to be added
col_comment: Comment for the column to be added
column_name2: Column followed by the added column

Example

ALTER TABLE `TBL` ADD COLUMN `COL2` STRING COMMENT 'test' AFTER `COL1`

ALTER TABLE `TBL` ADD COLUMN `COL2` STRING COMMENT 'test' FIRST



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback