hive hive中建立表

2021-08-21 18:17:15 字數 774 閱讀 2970

一、建立表語句

create table if not exists mydb.employees(

name string comment 'employee name',

salary float

subordinates arraydeductions mapaddress struct)

comment 'description of the table'

tblproperties ('creator'='me','created_at'='2018-07-25',...)

location '/user/hive/warehouse/mydb.db/employees';

二、tblproperties

tblproperties的主要作用是按鍵值對的格式為表增加額外的文件說明。hive會自動增加兩個表屬性,乙個是last_modified_by,儲存著最後修改這個表的使用者的使用者名稱;另乙個是last_modified_time,儲存著最後一次修改的時間。

三、儲存路徑:

預設的「資料倉儲」路徑位址是/user/hive/warehouse,mydb是資料庫目錄,employees是表目錄

四、使用者可以拷貝一張表的定義而無需拷貝資料

create table if not exists mydb.employees2

like mydb.employees;

Hive hive表中的資料匯出

insert overwrite local directory export servers exporthive a select from score insert overwrite local directory export servers exporthive row format d...

hive hive 內部表和外部表

1.內部表 hive test1 create table com inner person id int,name string,age int,ctime timestamp row format delimited fields terminated by oktime taken 0.233...

Hive hive表中載入資料

五種情況 create table score3 like score 插入資料 insert into table score3 partition month 201807 values 001 002 100 通過load方式載入資料 load data local inpath export...