Altering a Column

Function

The ALTER TABLE ... ALTER COLUMN command is used to change the attributes of a column, such as the column type, position, and comment.

Syntax

ALTER TABLE Table name ALTER

[COLUMN] col_old_name TYPE column_type

[COMMENT] col_comment

[FIRST|AFTER] column_name

Parameter Description

Table 1 ALTER COLUMN parameters

Parameter

Description

tableName

Table name.

col_old_name

Name of the column to be altered.

column_type

Type of the target column.

col_comment

Column comment.

column_name

New position to place the target column. For example, AFTER column_name indicates that the target column is placed after column_name.

Example

Response

You can run the DESCRIBE command to view the modified column.