- Write hive over the terminal
hive
it will redirect to the the hive shell.
- show the available databases in the hive
show databases
- Use the current database in the hive
use <database_name>
- Create a new database in the hive
create database <database_name>
- describe your database in the hive
describe <database_name>
- create a table in hive
create table <table_name>
(column_name datatype)
row format delimited
fields terminated by ',';
- we can craete one sample table.
create table ineuron
(emp_id int,
location string,
email_id string)
row format delimited
fields terminated by ‘ , ’ ;
)
- describe the table
describe formatted ineuron
-
check the location of the table.
-
create a .csv file in your system and write data to csv file.
101 hyd [email protected]
102 blr [email protected]
103 bpl [email protected]
-
keep your .csv file in the give table location
-
fetch the data from the table
select * from ineuron;
- alter the table in hive
alter table table_name to new_table_table;