大資料之Hive DML資料操作 二

2021-10-14 15:35:37 字數 871 閱讀 8157

資料匯入(增)

3.查詢語句中建立表並載入資料(as select)

create table if not exists student3

as select id, name from student;

4.建立表時通過location指定載入資料路徑

1.上傳資料到hdfs上

hive (default)> dfs -mkdir /student;

hive (default)> dfs -put /opt/module/datas/student.txt /student;

2.建立表,並指定在hdfs上的位置

hive (default)> create external table if not exists student5(

id int, name string

)row format delimited fields terminated by '\t'

location '/student'

;

3.查詢資料

hive (default)> select

*from student5;

5 .import資料到指定hive表中

注意:先用export匯出後,再將資料匯入。

hive (default)> import table student2 partition(month='201709'

)from

'/user/hive/warehouse/export/student'

;

6.sqoop匯入

大資料之Hive DML資料操作 一

1.資料匯入 增 1 1.向表中裝載資料 load 0 建立一張表 hive default create table student id string,name string row format delimited fields terminated by t 1 載入本地檔案到hive hi...

大資料之Hive DML資料操作 四

1.查詢 查 1 1.全表查詢 hive default select from emp 1 2.選擇特定列查詢 hive default select empno,ename from emp 2.刪除和更改 刪除delete from stu where id 1 修改 update stu s...

大資料之Hive DML資料操作 七

1.排序 1 1.全域性排序 order by order by 全域性排序,只有乙個reducer 1 使用 order by 子句排序 asc ascend 公升序 預設 desc descend 降序 2 order by 子句在select語句的結尾 3 案例實操 1 查詢員工資訊按工資公升...