Can you please help with Hive Query to get FirstName, MiddleName, LastName and Suffix from FullName in Hive. Thank you

0 votes
Can you please help with Hive Query to get FirstName, MiddleName,  LastName and Suffix from FullName in Hive. Thank you
May 15, 2019 in Big Data Hadoop by NAGALLA
• 120 points

retagged May 15, 2019 by Gitika 623 views

1 answer to this question.

0 votes

Hey,

You can get first name, middle name, last name and suffix from full name as follows:

Select 'full name' as col1, 

substring(col1 FROM1 FOR  POSITION(' ' IN col1)-1) as first_name,

 substring(col1 FROM POSITION(' ' IN col1)+1 as rest name, 

substring(rest_name from 1 FOR POSITION(' ' IN rest_name)-1 as middle_name, 

substring(rest_name from POSITION(' ' IN rest_name)+1)as last_name, 

substring(last_name from 1 FOR POSITION(' ' IN last_name)-1)as suffix;

If it works let me know.

answered May 15, 2019 by Gitika
• 37,370 points

edited May 15, 2019 by Gitika

Related Questions In Big Data Hadoop

0 votes
1 answer

How to retrieve/get complete HQL hive query from hive,spark and tez?

To get full query running for the ...READ MORE

answered Jul 11, 2019 in Big Data Hadoop by Yogi
1,077 views
0 votes
1 answer
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
• 69,030 points
1,743 views
+1 vote
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
• 10,950 points
5,875 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
• 10,950 points
882 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyF ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
37,069 views
–1 vote
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,320 points
2,195 views
0 votes
1 answer

How can you transfer data from hive to HDFS ?

Hey, Data in Hive tables reside on HDFS, ...READ MORE

answered May 16, 2019 in Big Data Hadoop by Gitika
• 37,370 points
559 views
0 votes
1 answer

How to get the column name printed in a file along with the output in Hive?

Hi @Neethu, Regarding your query, I would suggest ...READ MORE

answered Jul 2 in Big Data Hadoop by Gitika
• 37,370 points
125 views