1. load file

  1) syntax

     load data [local] inpath 'filepath' [overwrite] into table

     tablename [partition (partcol1=val1, partcol2=val2 ...)]

  2) example

     load data local inpath '/tmp/sales.txt' into table sales;

     load data inpath '/sales.txt' into table sales;

     load data inpath '/sales.txt' overwrite into table sales;


2. insert data 

  1) syntax

     insert overwrite table tablename [partition (partcol1=val1, partcol2=val2 ...)

     [if not exists] select select select_statement from table;


     FROM from_statement

     INSERT OVERWRITE TABLE tablename1 [PARTITION (partcol1=val1, partcol2=val2 ...) [IF NOT EXISTS]] select select_statement1

     [INSERT OVERWRITE TABLE tablename2 [PARTITION ... [IF NOT EXISTS]] select      select_statement2] [INSERT INTO TABLE tablename2 [PARTITION ...] select select_statement2] ...;


  2) example

     insert into sales select * from sales_rgn;

     insert into sales select * from sales_rgn where state = 'Test';

     insert overwrite table sales select * from sales_rgn;

     insert overwrite table sales select * from sales_rgn where id = 1;


   



     

'NoSQL > Hive' 카테고리의 다른 글

Hive authentification  (0) 2016.10.16
Hive authorization  (0) 2016.10.16
Hive DDL  (0) 2016.10.15
Hive Tuning  (0) 2016.06.27
Hue 구성  (0) 2016.06.14

+ Recent posts