Teradata Alter Table Rename Column

Teradata Alter Table with Rename option is used to rename a column name in Teradata Table.

Teradata Alter Table Rename Column Syntax

The syntax of Teradata Alter Table Rename Column is as follows.

Alter Table database_name.tbl_name 
Rename column_name to new_column_name;

Teradata Alter Table Rename Column Example

Consider the definition of employee table as follows.

show table Teradatapoint.employee;

CREATE SET TABLE Teradatapoint.employee ,FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT,
DEFAULT MERGEBLOCKRATIO,
MAP = TD_MAP1
(
empid INTEGER,
empname VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
hobbies VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC DEFAULT 'Listen to Music',
native_place VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL)
)
UNIQUE PRIMARY INDEX ( empid );

The following example rename the hobbies column to extra_curricular.

Alter Table database_name.tbl_name 
Rename hobbies to extra_curricular;

You can verity the same from the table definition of employee now.

show table Teradatapoint.employee;

CREATE SET TABLE Teradatapoint.employee ,FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT,
DEFAULT MERGEBLOCKRATIO,
MAP = TD_MAP1
(
empid INTEGER,
empname VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
hobbies VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC DEFAULT 'Listen to Music',
extra_curricular VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL)
)
UNIQUE PRIMARY INDEX ( empid );

Summary: In this tutorial, you have learned how to rename a column name in Teradata table.

Also Read:- 

  1. Add new column in Teradata Table.
  2. Modify existing column.
  3. Drop column from Teradata Table.

Leave a Comment