1 创建一个分区表

create table t_partition001(ip string,duration int)
partitioned by(country string)
row format delimited
fields terminated by ',';

2 添加数据

load data local inpath '/root/hivedata/t_partitioned' into table t_partition001 partition(country="China");

3 增加一个分区

alter table t_partition001 add partition(country="Japan");

4添加数据

 load data local inpath '/root/hivedata/t_partitioned' into table t_partition001 partition(country="Japan");

5  show partitions t_partition001;

6删除分区

alter table t_partition001 drop partition(country="Japan");

7修改表名

 alter table t_partition001 rename to t_partition002;

8表增加一列

 alter table t_partition002 add columns(city string);

9 替换表中所有字段

alter table t_partition002 replace columns(name string);

10 更新某一列

大数据学习——hive数仓DML和DDL操作的更多相关文章

  1. 在HUE中将文本格式的数据导入hive数仓中

    今天有一个需求需要将一份文档形式的hft与fdd的城市关系关系的数据导入到hive数仓中,之前没有在hue中进行这项操作(上家都是通过xshell登录堡垒机直接连服务器进行操作的),特此记录一下. - ...

  2. 大数据学习——hive基本操作

    1 建表 create table student(id int,name string ,age int) row format delimitedfields terminated by ','; ...

  3. 大数据学习——hive数据类型

    1. hive的数据类型Hive的内置数据类型可以分为两大类:(1).基础数据类型:(2).复杂数据类型2. hive基本数据类型基础数据类型包括:TINYINT,SMALLINT,INT,BIGIN ...

  4. 大数据学习——hive显示命令

    show databases; desc t_partition001; desc extended t_partition002; desc formatted t_partition002; !c ...

  5. 大数据学习——hive的sql练习题

    ABC三个hive表 每个表中都只有一列int类型且列名相同,求三个表中互不重复的数 create table a(age int) row format delimited fields termi ...

  6. 大数据学习——hive函数

    1 内置函数 测试各种内置函数的快捷方法: 1.创建一个dual表 create table dual(id string); 2.load一个文件(一行,一个空格)到dual表 3.select s ...

  7. 大数据学习——hive的sql练习

    1新建一个数据库 create database db3; 2创建一个外部表 --外部表建表语句示例: create external table student_ext(Sno int,Sname ...

  8. 大数据学习——hive安装部署

    1上传压缩包 2 解压 tar -zxvf apache-hive-1.2.1-bin.tar.gz -C apps 3 重命名 mv apache-hive-1.2.1-bin hive 4 设置环 ...

  9. 大数据学习——hive使用

    Hive交互shell bin/hive Hive JDBC服务 hive也可以启动为一个服务器,来对外提供 启动方式,(假如是在itcast01上): 启动为前台:bin/hiveserver2 启 ...

随机推荐

  1. Pursuit For Artifacts CodeForces - 652E

    https://vjudge.net/problem/CodeForces-652E 边双啊,就是点双那个tarjan里面,如果low[v]==dfn[v](等同于low[v]>dfn[u]), ...

  2. python programming

    1. super 2. *args, **kwargs 3. class object 4. type 5. isinstance 6. list[:] = another_list

  3. dos 下 批量替换 只支持txt

    首先必须存成 bat 格式,其次识别不了word 1.bat ##替换12 成12*3 @echo offsetlocal enabledelayedexpansionfor /F "tok ...

  4. Excel 宏练习

    任务描述: 利用 Excel 绘制函数图像 f(x)=x^2/3+0.9*(3.3-x^2)^1/2*sin(a*x),并通过按钮事件来刷新图像. 问题分析: 可以参考类似 Matlab 绘图的方式, ...

  5. 148 Sort List 链表上的归并排序和快速排序

    在使用O(n log n) 时间复杂度和常数级空间复杂度下,对链表进行排序. 详见:https://leetcode.com/problems/sort-list/description/ Java实 ...

  6. Object类的几个方法

    1.protected Object clone()创建并返回此对象的一个副本. 2. boolean equals(Object obj)指示其他某个对象是否与此对象“相等”. 3. protect ...

  7. ThreadPoolExecutor 线程池

    TestThreadPoolExecutorMain package core.test.threadpool; import java.util.concurrent.ArrayBlockingQu ...

  8. IOS访问webserver接口

    接口调用参数只能是字符串格式,返回格式支持3种(字符串,数组,DataSet) 需要引用第三方库,包含(DataSet,PlatServinceDataParser,WebserviceCommon, ...

  9. Linux PHP的运行模式

    关系图 首先聊一下服务器,常见的web server类型有apache和nginx Apache工作模式 Apache的工作模式是Apache服务器在系统启动后,预先生成多个进程副本驻留在内存中,一旦 ...

  10. Solidity 智能合约开发

    需要专用浏览器或部署节点支持. Solidity (中文:固态,固体)是一种语法与Javascript相似的高级语言,它为Ethereum虚拟机(EVM)编译代码而设计. Solidity是静态类型的 ...