• hive操作


    ==========================================================
    练习建表语句 (struct使用的分割符是和collection相同的)
    ==========================================================
    CREATE TABLE emp(
    name string,
    salary float,
    likes array<string>,
    cloco map<string,string>,
    address struct<country:string,city:string,state:string,zip:string>
    )
    PARTITIONED BY(country STRING,state string)
    ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' COLLECTION ITEMS TERMINATED BY '-' MAP KEYS TERMINATED BY ':'
    STORED AS TEXTFILE;

    ==========================================================
    删除表
    - - - - - - - - - - - - - - - - - - - -
    drop table psn1;
    ==========================================================
    从linux本地导入数据
    - - - - - - - - - - - - - - - - - - - -
    load data local inpath '/usr/bianji' into table psn5 partition(year=2018);
    ==========================================================
    给表添加分区
    - - - - - - - - - - - - - - - - - - - -
    alter table psn5 add partition(country='us',state='use');
    ==========================================================
    查看表的分区
    - - - - - - - - - - - - - - - - - - - -
    show partitions psn5;
    ==========================================================
    删除表的分区
    - - - - - - - - - - - - - - - - - - - -
    alter table psn5 drop partition(year=2018);
    ==========================================================
    表重新名命
    - - - - - - - - - - - - - - - - - - - -
    alter table employee rename to emp
    ==========================================================
    strict模式下查询表
    - - - - - - - - - - - - - - - - - - - -
    select * from emp where country='us' and state='use';
    ==========================================================

  • 相关阅读:
    Android基本功:Socket
    Javascript模板及其中的数据逻辑分离思想
    MFC,QT与WinForm,WPF简介
    GPIB、USB、PCI、PCI Express和以太网/LAN/LXI
    Office批量授权(VL)版本和激活方法
    Labview 错误1400-打包库封装类时将对类重命名导致
    console.log()
    a标签中href=""的几种用法
    正斜杠"/"与反斜杠""
    提问的艺术
  • 原文地址:https://www.cnblogs.com/huiandong/p/9431382.html
Copyright © 2020-2023  润新知