Hive what location should I mention while creating table

0 votes
create external table zemp202_external (e_id int,e_name string,e_exp int)
row format delimited fields terminated by ' '
location '/user/hive/warehouse/zemp202_external';

the above location should be warehouse path or it can be local/hdfs path?(because I tried with hdfs path it's not working) ??

May 23, 2019 in Big Data Hadoop by Ritu
5,058 views

1 answer to this question.

0 votes

It can be a hdfs path. The hive external table is created and the location is given of hdfs so that the data gets loaded into the table through the file present in the hdfs and we won't have to execute the load command to load the data in our table.

Go through the below example for creating the hive external table,

When you create an external table, you can give the path of the file from which you want to add the data in the table.

Suppose, your file is in the directory named flag in hdfs. Now, to load the data from this file you will have to execute the below query

create external table country (name string, landmass string,
zone string, area int)row format delimited fields terminated by ','
stored as textfile location "/user/edureka_398276/flag"; 

The above command will get the data from the file stored in the directory in hdfs named flag and store the data in the table named a country. This way we don't have to execute the load data command to load the data in our table.

The syntax for the above command is as below:

create external table <table_name> (<column_name> <data_type>, <column_name> <data_type>, ...) 
row format delimited fields terminated by '<field_delimiter>' 
stored as <file_type> location <hdfs_path>

answered May 23, 2019 by Jishan

Related Questions In Big Data Hadoop

–1 vote
1 answer

Error while creating Hive Database table

In your error, it says that the ...READ MORE

answered Jan 8, 2019 in Big Data Hadoop by Omkar
• 69,230 points
2,881 views
0 votes
1 answer

What is the syntax for creating bucketing table in hive?

Hi, Syntax for creating bucketed table is as ...READ MORE

answered May 16, 2019 in Big Data Hadoop by Gitika
• 65,890 points
1,448 views
0 votes
1 answer
+3 votes
1 answer

Getting Connection Error while loading data into table using cloudera hive

Hey Nafeesa, Itseems that Hive is not able ...READ MORE

answered Oct 4, 2018 in Big Data Hadoop by Vardhan
• 13,190 points
935 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
10,924 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,453 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
108,319 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,390 points
4,547 views
0 votes
1 answer

What is the significance of ‘IF EXISTS” clause while dropping a table in Hive?

Hi, Since the table being dropped does not ...READ MORE

answered Jun 26, 2019 in Big Data Hadoop by Gitika
• 65,890 points
2,835 views
0 votes
2 answers

How to change the location of a table in hive?

Changing location requires 2 steps: 1.) Change location ...READ MORE

answered Feb 12, 2020 in Big Data Hadoop by Saksham Sehrawet
8,922 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