zoukankan      html  css  js  c++  java
  • hive一些语句

    row format delimited fields terminated by ' ' 创建表时以  作为分隔符

    location '/student'创建表时设置表的路径

    insert overwrite local directory
    '/opt/module/hive/data/export/student'[ROW FORMAT DELIMITED FIELDS TERMINATED BY ' ']

    select * from student;查询结果导出到本地

    alter table student2 set tblproperties('EXTERNAL'='TRUE');修改student2 表为外部表

    desc formatted student2;查看表结构

    create table student2 as select * from student where name = 'zhoayi' 创建一个和student结构一样且name属性为‘zhaoyi’的表

    truncate table student;删除表中数据

    load data local inpath '/opt/module/datas/dept.txt' into table dept;加载本地(虚拟机)中的dept.txt文件到dept表中

     drop database db_hive [cascade];删除数据库【如不为空强制删除】

     collect_set(day_id)[0] as day_id 当将某个表查询到的东西加到另一个表时,且该表的某些字段不需要变化用这个。

    create table saledl1 row format delimited fields terminated by ',' as select * from sales1 where sale_nbr like concat("C","%");hive里的正则匹配。

  • 相关阅读:
    Hive 使用问题集锦
    scala def/val/lazy val区别以及call-by-name和call-by-value
    spark学习流程
    Hadoop
    Hive
    Chrome快捷键
    Java API帮助文档
    Java 访问修饰符与非访问修饰符
    java 关键字
    Solr配置Ikanalyzer分词器
  • 原文地址:https://www.cnblogs.com/zhaoyids/p/15349019.html
Copyright © 2011-2022 走看看