Hive快速入门

启动Hive

[hadoop@hadoop000 ~]$ cd $HIVE_HOME
[hadoop@hadoop000 hive-1.1.0-cdh5.15.1]$ hive

创建数据库:create database test_db;(分号;别忘了加)
创建表test_db
hive> create table helloworld(id int,name string) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\t’;
查看数据库test_db都有哪些表
hive> show tables;
查询表helloworld里面的内容
hive> select * from helloword;
将/home/hadoop/data/helloworld.txt写入表helloworld
hive> load data local inpath ‘/home/hadoop/data/helloworld.txt’ overwrite into table helloworld;
统计表helloworld有多少条数据,利用MapReduce
hive> select count(1) from helloworld;
查看当前hive在哪个数据库
hive> set hive.cli.print.current.db=true;
hive (default)> show databases;(当前在default数据库)
清除当前屏幕
hive> !clear;
删除数据库:删除的数据库必须为空,如果不为空则无法删除
hive (test_db)> drop database hive3;
查看匹配某些字符的数据库有哪些
hive (hive2)> show databases like ‘hive*’;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

马鹏森

太谢谢了

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值