Hadoop-Hive commands #2

  • date 14th March, 2019 |
  • by Prwatech |
  • To enter the hive shell:

Command:  hive

  • To create a database:

Command: create database prwatech;

  • To see the list of databases:

Command: show databases;

  • To use a particular database to create table:

Command: use prwatech;

  • Move data form lfs to hdfs:

Command: hadoop fs -copyFromLocal ‘–LOCATION OR PATH OF DOCUMENT–’ /user/cloudera (On new terminal)

  • Create a table:


create table cricket (Player_NameSTRING,


FLOAT) row format delimited fields terminated by ‘,’

stored as textfile;

  • To load data into the table:

Command:LOAD DATA INPATH ‘/user/cloudera/cricketdoc.txt’ OVERWRITE INTO table cricket;

  • To create an external table:

Command: create external table cricketext


dINT,Strike_Rate FLOAT) row format delimited

fields terminated by ‘,’ stored as textfile LOCATION


  • To insert the data from cricket table to external table cricketext:

Command: from cricket cric insert overwrite table

cricketext select cric.Player_Name,

cric.Runs_Scored, cric.Balls_Faced,cric.Strike_Rate;

  • To see the data in external table:

Command: select * from cricketext;

Leave a Reply

Your email address will not be published. Required fields are marked *

Quick Support

image image