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里的正则匹配。

  • 相关阅读:
    [转载]c++转python
    [转载]One-hot编码
    [转载]各种机器学习算法的应用场景
    SVC和SVR
    机器学习-正则化+回归与分类辨析
    C#编译时,提示缺少NuGet包
    C++中 左值和右值的区别
    C++11并发编程实战 免费书籍
    静态库和动态库
    C++中string类
  • 原文地址:https://www.cnblogs.com/zhaoyids/p/15349019.html
Copyright © 2011-2022 走看看