user1554472
user1554472

Reputation: 57

In Hive, Is there a way to add column X before column Y

In Hive is there a way to add a new column before a specified column?

I know we can use “after” keyword to add a column after a given column.

Alter table table_name change col_name col_name type after col1_name

But “before” keyword doesn’t exist for a similar scenario

Upvotes: 0

Views: 468

Answers (1)

Kuwali
Kuwali

Reputation: 253

No, before keyword does not exist for alter table in hive. Do you want to use 'before' because you want the newly added column to be the first column? In that case, hive provides you with a 'first' keyword.

you can refer to the following answer for beautiful explanation:

In hive, is there a way to specify between which columns to add a new column to?

Upvotes: 1

Related Questions