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的前面)

  • 相关阅读:
    在Wince下使用钩子函数
    WinCE下钩子应用(一)——WinCE 下实时捕获键盘消息
    记录此刻
    常用数列
    百度之星度度熊拼三角
    笛卡尔定理
    Lucas定理
    简单概念
    Unknown Treasure Lucas+中国剩余定理+快速乘
    2017ccpc杭州站 Problem B. Master of Phi
  • 原文地址:https://www.cnblogs.com/kwzblog/p/7472516.html
Copyright © 2011-2022 走看看