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. linux常用的shell命令

    1.shell介绍 shell(外壳)是linux系统的最外层,简单的说,它就是用户和操作系统之间的一个命令解释器. 2.shell命名的使用 ls :查看当前目录的信息,list .        ...

  2. 执行impdp时ORA-39213: Metadata processing is not available错误处理

    通过impdp命令将Oracle11g数据库的dmp文件导入至Oracle10g中时,报出如下错误: [oracle@dbsrv3 ~]$ impdp dhccms/dhccms DIRECTORY= ...

  3. AIDL(1):简介

    Android 接口定义语言 (AIDL) 1.AIDL是什么 AIDL(Android 接口定义语言)与您可能使用过的其他 IDL 类似. 您可以利用它定义客户端与服务使用进程间通信 (IPC) 进 ...

  4. MySQL防止重复插入记录SQL

    INSERT INTO sysuser(') DUAL:表示虚拟表 sysuser:表名称

  5. PHP实现XML传输

    sendXML.php   <!--发送XML的页面--> <?php $xml_data = '<xml>...</xml>';//发送的xml $url ...

  6. 【学习笔记】深入理解js原型和闭包(18)——补充:上下文环境和作用域的关系

    本系列用了大量的篇幅讲解了上下文环境和作用域,有些人反映这两个是一回儿事.本文就用一个小例子来说明一下,作用域和上下文环境绝对不是一回事儿. 再说明之前,咱们先用简单的语言来概括一下这两个的区别. 0 ...

  7. 原创:E325: ATTENTION vim超完整超给力的问题与解决方法

    又到了老葵花哥哥开课的时间 这是给大家提供一个企业常见的错误 我相信大家生活还编程中会长期使用接触这个错误 这里我们经常用的两个选项 (E)dit any way 编辑原来的文件,忽略刚刚做的修改 ( ...

  8. SQLite-And和OR运算符

    SQLite - AND 和 OR 运算符 SQLite AND . OR运算符用于编译多个条件缩小在一个SQLite声明中选定的数据.这两个操作符被称为连接的操作符. 这些操作符与不同操作提供了一种 ...

  9. CSS 功能简介

    CSS的功能主要包括节点管理(Node Management,以下简称NM)和组管理(Group Management,以下简称GM)两部分,都是由守护进程ocssd.bin 来实现的,这是个多线程的 ...

  10. Python3 OpenCV3 图像处理基础

    开发环境搭建 本人使用的是Ubuntu 16.04LTS. 1.安装Python3 ## 其实 Ubuntu 16.04 系统自带了 Python 3.5.2,因此不需要再安装了?但是需要安装一些开发 ...