hive 可以使用一次性命令的方式来执行给定的大量的hql语句。
hive -e "SQL语句"
例如: vi hivesqlaa.hql
#! /bin/bash
hive -e "create table t_name(name string,age int,sex string);"
hive -e "insert into table t_name select a_name,a_age,a_sex from 数据库名 group by 字段;"
执行:hive -f hivesqlaa.hql