Home > Notes > HIVE

creating_Internal_and_External_Table

HIVE

hive buit in operation
Hive Partition By _and _buecketing
Hive Partition By
HIVE VIEW
HiveQl_Part1
Hive_Built_In_Functions
Hive_QL_JOIN
Hive_Table_Operation

creating_Internal_and_External_Table

creating_Internal_and_External_Table

1.) External Table:=> An external table is a table for which Hive does not manage storage. If you delete an external table, only the definition in Hive is deleted. The data remains. An internal table is a table that Hive manages. If you delete an internal table, both the definition in Hive and the data are deleted. create external table emp1(id int, name string, role string, zip int, code int , rank int , keyword string) row format delimited fields terminated by',' lines terminated by'\n' stored as textfile; loading the data :=> a.) using local :=> load data local inpath '/home/itv199411/employee.txt' into table emp1; b.) using hdfs load data inpath '/user/itv199411/employee.txt' into table emp1; 2.) Internal Table :=> Internal table are like normal database table where data can be stored and queried on. On dropping these tables the data stored in them also gets deleted and data is lost forever. So one should be careful while using internal tables as one drop command can destroy the whole data. create table emp5(id int, name string, role string, zip int, code int , rank int , keyword string) row format delimited fields terminated by',' lines terminated by'\n' stored as textfile; loading the data :=> a.) using local :=> load data local inpath '/home/itv199411/employee.txt' into table emp2; b.) using hdfs load data inpath '/user/itv199411/employee.txt' into table emp2;

creating_Internal_and_External_Table

1.) External Table:=> An external table is a table for which Hive does not manage storage. If you delete an external table, only the definition in Hive is deleted. The data remains. An internal table is a table that Hive manages. If you delete an internal table, both the definition in Hive and the data are deleted. create external table emp1(id int, name string, role string, zip int, code int , rank int , keyword string) row format delimited fields terminated by',' lines terminated by'\n' stored as textfile; loading the data :=> a.) using local :=> load data local inpath '/home/itv199411/employee.txt' into table emp1; b.) using hdfs load data inpath '/user/itv199411/employee.txt' into table emp1; 2.) Internal Table :=> Internal table are like normal database table where data can be stored and queried on. On dropping these tables the data stored in them also gets deleted and data is lost forever. So one should be careful while using internal tables as one drop command can destroy the whole data. create table emp5(id int, name string, role string, zip int, code int , rank int , keyword string) row format delimited fields terminated by',' lines terminated by'\n' stored as textfile; loading the data :=> a.) using local :=> load data local inpath '/home/itv199411/employee.txt' into table emp2; b.) using hdfs load data inpath '/user/itv199411/employee.txt' into table emp2;