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 2,141 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
• 65,770 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
4,330 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 21, 2018 in Big Data Hadoop by Omkar
• 69,220 points
4,912 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
• 11,380 points
11,072 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
• 11,380 points
2,571 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
109,058 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,350 points
4,639 views
0 votes
1 answer
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
• 65,770 points
2,725 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP