hive create database/table 和 hive 命令操作
来源:互联网 发布:淘宝网简介ppt 编辑:程序博客网 时间:2024/06/05 16:38
create database db_hive_01 ;
create database if not exists db_hive_02 ; --> 标准
create database if not exists db_hive_03 location '/user/beifeng/hive/warehouse/db_hive_03.db' ;
show databases ;
show databases like 'db_hive*' ;
use db_hive ;
desc database db_hive_01 ;
desc database extended db_hive_01 ;
drop database db_hive_01 ;
//级联删除数据库
drop database db_hive_01 cascade;
drop database if exists db_hive_01 ;
2.create table 三种方式
create table if not exists table1
(
id string comment 'id',
name string,
url string comment 'url'
)
comment 'table'
ROW FORMAT delimited fields terminated by ' '
STORED AS TEXTFILE
LOCATION '/user/hive/hive01' ;
create table if not exists table2
AS select id,name url from table1 ;
create table if not exists table3
LIKE table1 ;
详细信息 查询
desc table1 ;
desc extended table1;
desc formatted table1
表数据的load
load data local inpath ‘’ into table table1
清空表的数据
TRUNCATE TABLE table_name
update tablename
alter table table1 rename to table11
drop table if exists table1
3.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
-h <hostname> connecting to Hive Server on remote host
--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
-p <port> connecting to Hive Server on port number
-S,--silent Silent mode in interactive shell
-v,--verbose Verbose mode (echo executed SQL to the
console)
* bin/hive -e <quoted-query-string>
eg:
bin/hive -e "select * from db_hive.student ;" //不进入cli 命令
* bin/hive -f <filename> 脚本写在文件中
eg:
$ touch hivef.sql
select * from db_hive.student ;
$ bin/hive -f /opt/datas/hivef.sql 执行脚本
$ bin/hive -f /opt/datas/hivef.sql > /opt/datas/hivef-res.txt 结果写到文件中去
在hive cli命令窗口中如何查看hdfs文件系统
hive (default)> dfs -ls / ;
在hive cli命令窗口中如何查看本地文件系统
hive (default)> !ls /opt/datas ;
!cat hive.sql ;
外部表和内部表的区别
http://www.aboutyun.com/thread-7458-1-1.html
- hive create database/table 和 hive 命令操作
- hive create extenal table
- Hive中的数据库(Database)和表(Table)
- hive的create table 问题
- error: hive create table failed
- Hive Create/Drop/Bucketed Table
- HIVE CREATE TABLE(一)
- Hive table 操作
- hive随谈(hive操作create,alter等)
- hive Create/Drop/Alter/Use Database
- [一起学Hive]之三–Hive中的数据库(Database)和表(Table)
- [一起学Hive]之三–Hive中的数据库(Database)和表(Table)
- [一起学Hive]—Hive中的数据库(Database)和表(Table)
- hive操作create,alter等
- HIVE入门—初尝Create Table
- Hive create external table partition关联数据文件
- hive 基本命令操作
- Hive命令及操作
- jAVA IO 以及 NIO 理解
- android4.4.2修改系统分区大小
- Android应用全局获取Context的技巧
- 找单词问题
- 随机数发生器
- hive create database/table 和 hive 命令操作
- 并查集趣味解释
- OKHttp的常用配置如配置Https证书,忽略Https证书,Cookie持久化
- 点击home键之后重新进入程序, fragment为null
- 开篇之作------20160804
- 在一个form表单中根据不同按钮实现多个action事件
- 使用navicat将csv文件导入mysql
- KVM进阶
- 160804方法调用的练习题2