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. 洛谷1387(基础二维dp)

    题目很简单,数据也很小,但是思路不妨借鉴:dp[i][j]代表以(i,j)为右下角的最长正方形边长. 类比一维里面设“以XX为结尾的最XXX(所求)”. 另外define不要乱用!尤其这种min套mi ...

  2. 模板——扩展欧几里得算法(求ax+by=gcd的解)

    Bryce1010模板 /**** *扩展欧几里得算法 *返回d=gcd(a,b),和对应等式ax+by=d中的x,y */ long long extend_gcd(long long a,long ...

  3. oracle如何设置最大连接数

    查看session: select * from v$session where username is not null select username,count(username) from v ...

  4. 转 google 制作 邀请函

    http://blog.csdn.net/adali/article/details/8315619

  5. 152 Maximum Product Subarray 乘积最大子序列

    找出一个序列中乘积最大的连续子序列(该序列至少包含一个数).例如, 给定序列 [2,3,-2,4],其中乘积最大的子序列为 [2,3] 其乘积为 6.详见:https://leetcode.com/p ...

  6. ubuntu16.04里如何正确添加用root用户来登录图形界面(图文详解)

    不多说,直接上干货! Ubuntu版本都默认不允许使用root登录,必须要改配置文件. 第一步: 首先设置root密码,利用现有管理员帐户登陆Ubuntu,在终端执行命令:sudo passwd ro ...

  7. mysql索引原理及创建与查询

    索引介绍 一:为什么要有索引 索引是用来优化查询效率(速度)的 没有索引的话,对于大数据的表,就只能每次都遍历一遍,数据量越大,耗时越多有索引的话,可以提升好几个数量级的速度 一般的应用系统,读写比例 ...

  8. makefile vpath变量

    在讲vpath之前,我们首先了解以下makefile文件. 在类Unix系统中,当我们使用源码编译某个软件的时候,我们会使用confiure,make,make install这三个命令,其中cofi ...

  9. ElasticSearch数据库同步插件logstash

    1.下载和elasticsearch 相同版本的logstash. 2.进行解压后,进入bin下,新建一个文件mysql.conf,并输入 input { stdin{ }} output { std ...

  10. 目录下 shift 右键菜单 打开cmd 或者在 地址栏输入cmd 回车进入cmd

    目录下 shift 右键菜单 打开cmd 或者在 地址栏输入cmd 回车进入cmd