20190831
hive> sql語句
hive>
show
databases
;# 顯示所有的資料庫
hive>
use base_name;
# 選擇資料庫
hive>
show
tables
;# 當前資料庫下所有的table+view
hive>
select
*from table_name;
# sql語句
hive> quit;
# 退出hive
$ hive -e "合法的sql語句"
# 可以增加引數 `-s`開啟靜默模式,會去掉輸出結果中無關行
$ hive -s -e "合法的sql語句"`
$ hive -s -e "select * from table_name"
$ hive -s -e "select * from table_name"
> /path/filename
#/path為將輸出結果從 標準輸出 重定向 到該路徑下filename檔案下
$ hive -f /path/filename.sql
$ hive -f /path/myfile/myscript.sql
參考《hive 程式設計指南》hive命令的三種執行方式
hive指令碼的三種執行方式
1.hive控制台執行,安裝了hive之後直接命令列輸入hive,進入控制台。2.hive e sql語句 直接輸入就會有結果,sql語句根據具體情況自己書寫 a.sql的內容如下 set mapred.job.queue.name default set hive.exec.reducers.ma...
hive三種呼叫方式
一 hive e sql語句 shell命令 適合比較短的sql語句呼叫,優點是可以直接在shell中呼叫 靜音模式 s 在執行hiveql過程中,不在顯示器輸出mr的執行過程 hive s e sql語句 test.txt 將執行結果直接輸入到本地檔案 二 hive f sql.sql shell...
hive指令碼的執行方式大致有三種
hive指令碼的執行方式大致有三種 usage hive commands.e.g.d a b or define a b database specify the database to use e sql from command line f sql from files h,help pri...