Replace Column names and datatype in Hive

0 votes
Hi. Can someone tell me how I can replace the name and datatype of a column in Hive table? I have some data in that column of datatype INT and want to change the name of this column, and datatype to STRING. So if I replace the name, will the data still exist or will it be erased?
May 21 in Big Data Hadoop by Karan
7 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can replace the column name and the datatype using the ALTER command. Refer to the command below:

hive> ALTER TABLE <tablename> REPLACE COLUMNS (<old column name> INT, <new column name> STRING);

This command will only change the schema of the table i.e., it will change the column name and the datatype but will not affect the data stored in the column. 

answered May 21 by John

Related Questions In Big Data Hadoop

0 votes
1 answer

Hadoop: How to get the column name along with the output in Hive?

You can get the column names by ...READ MORE

answered Nov 20, 2018 in Big Data Hadoop by Omkar
• 66,910 points
102 views
0 votes
2 answers

How to get column names from Hive table?

To get all the columns of a ...READ MORE

answered Jun 4 in Big Data Hadoop by anonymous

edited Jun 4 by Omkar 816 views
0 votes
1 answer

How to replace characters in string in hive?

You can do it using regexp_replace. This is ...READ MORE

answered Nov 29, 2018 in Big Data Hadoop by Omkar
• 66,910 points
1,459 views
0 votes
1 answer

Beeline and Hive Query Editor in Embedded mode

Running Hive client tools with embedded servers ...READ MORE

answered Dec 31, 2018 in Big Data Hadoop by Omkar
• 66,910 points
137 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 9,450 points
1,844 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 9,450 points
159 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
9,139 views
0 votes
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,260 points
656 views
0 votes
1 answer

How to add column inside a table in Hive?

Hi, Yes, we can add column inside a ...READ MORE

answered May 15 in Big Data Hadoop by Gitika
• 14,910 points
10 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.