zoukankan      html  css  js  c++  java
  • Hive_常用交互命令

    [atguigu@hadoop102 hive]$ bin/hive -help

    usage: hive
     -d,--define <key=value>          Variable subsitution to apply to hive
                                      commands. e.g. -d A=B or --define A=B
        --database <databasename>     Specify the database to use
     -e <quoted-query-string>         SQL from command line
     -f <filename>                    SQL from files
     -H,--help                        Print help information
        --hiveconf <property=value>   Use value for given property
        --hivevar <key=value>         Variable subsitution to apply to hive
                                      commands. e.g. --hivevar A=B
     -i <filename>                    Initialization SQL file
     -S,--silent                      Silent mode in interactive shell
     -v,--verbose                     Verbose mode (echo executed SQL to the console

    1.“-e”不进入hive的交互窗口执行sql语句

    [atguigu@hadoop102 hive]$ bin/hive -e "select id from student;"

    2.“-f”执行脚本中sql语句

             (1)在/opt/module/datas目录下创建hivef.sql文件

    [atguigu@hadoop102 datas]$ touch hivef.sql

                  文件中写入正确的sql语句

                  select *from student;

             (2)执行文件中的sql语句

    [atguigu@hadoop102 hive]$ bin/hive -f /opt/module/datas/hivef.sql

    (3)执行文件中的sql语句并将结果写入文件中

    [atguigu@hadoop102 hive]$ bin/hive -f /opt/module/datas/hivef.sql  > /opt/module/datas/hive_result.txt

    学习中,博客都是自己学习用的笔记,持续更新改正。。。
  • 相关阅读:
    Android中Activity和Fragment之间的通信
    用Android布局和简单控件实现的一个常见的界面
    【Linux】linux常用基本命令 [轉載]
    本地项目上传到gitlab
    spring boot 配置redis
    linux mysql的安装
    linux 安装 java环境变量
    mvc 跨域
    JSON 的几种简单格式和转换
    地区三级联动和全盘扫描索引的建立
  • 原文地址:https://www.cnblogs.com/Tunan-Ki/p/11795658.html
Copyright © 2011-2022 走看看