zoukankan      html  css  js  c++  java
  • hive表的DDL

    查看表
                hive> show tables;
    创建表
                hive> create table t1(id int);
    查看表结构
                hive> desc [extended] t1;
                    extended是可选的,是扩展的表的信息

    查看表的创建语句
                hive> show create table t1;

    在metastore中查看
                在表TBLS中有创建的表的信息

    删除表
                hive> drop table t1;

    重命名表的名称
                hive> alter table t1 rename to t1_ddl;

    修改表中的某一列
                hive> alter table t1_ddl change id t_id int;
     增加列

    mysql:alter table add column colname coltype;

    hive> alter table add columns (colname coltype...);可以增加多列

    hive> alter table t1_ddl add columns(name string comment 'name', age int);

    替换整个表列

    hive> alter table t1_ddl replace columns(name string comment 'name', age int);

    移动某一列的位置,将某一列放在最前面

    hive> alter table t1_ddl add columns(id int);(增加原有的数据)

    hive> alter table t1_ddl change id id int first;

    将某一列移动到另外一列的后面或前面

    hive> alter table t1_ddl change age age int after id;(将age放在id的后面或name的前面)

  • 相关阅读:
    扫盲如何在ECLIPSE中使用条件断点
    春困
    气虚咳喘案
    知足老师论糖尿病
    辨痰之病位与寒热
    常用中药功效比较(任之堂)
    女子全身窜痛案
    小儿外感案
    紫斑案
    读任之堂中药讲记笔记
  • 原文地址:https://www.cnblogs.com/kwzblog/p/7472516.html
Copyright © 2011-2022 走看看