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
155 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
• 68,940 points
483 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
• 26,030 points
133 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
• 13,100 points
106 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,840 points
4,220 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,840 points
599 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
23,005 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,310 points
1,580 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
• 26,030 points
470 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 in Big Data Hadoop by Saksham Sehrawet
411 views