zoukankan      html  css  js  c++  java
  • 大数据学习——hive数仓DML和DDL操作

    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 更新某一列

  • 相关阅读:
    网文阅读笔记
    UUID
    各种网站
    项目
    常用正则表达式
    Struts 2.0 HelloWorld
    接口与抽象类(深入多态)
    #define的优点/volatile的好处
    基本套接口编程
    大小端判断及相互转化
  • 原文地址:https://www.cnblogs.com/feifeicui/p/10276165.html
Copyright © 2011-2022 走看看