Friday, 15 July 2016

thumbnail

Alter Table Statement in Hive

Alter Table Statement

It is used to alter a table in Hive.

Syntax

The statement takes any of the following syntaxes based on what attributes we wish to modify in a table.

ALTER TABLE name RENAME TO new_name
ALTER TABLE name ADD COLUMNS (col_spec[, col_spec ...])
ALTER TABLE name DROP [COLUMN] column_name
ALTER TABLE name CHANGE column_name new_name new_type
ALTER TABLE name REPLACE COLUMNS (col_spec[, col_spec ...])

Rename To… Statement

The following query renames the table from city to Delhi.
hive> ALTER TABLE city RENAME TO Delhi;

Output:

Table renamed successfully.

 


Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments

Powered by Blogger.

Search This Blog