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 in Big Data Hadoop by Ritu
66 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 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 in Big Data Hadoop by Omkar
• 68,180 points
320 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 in Big Data Hadoop by Gitika
• 25,420 points
84 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 3, 2018 in Big Data Hadoop by Vardhan
• 12,820 points
86 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
• 10,760 points
3,531 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,760 points
433 views
+1 vote
11 answers

hadoop fs -put command?

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

answered Dec 7, 2018 in Big Data Hadoop by Aditya
17,964 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,280 points
1,298 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 in Big Data Hadoop by Gitika
• 25,420 points
251 views
0 votes
1 answer

How to change the location of a table in hive?

Hey, Basically When we create a table in hive, ...READ MORE

answered May 14 in Big Data Hadoop by Gitika
• 25,420 points
246 views