hive中常用命令(建表、删表等)
1.hive中的语句使用英文;结尾
2.进入数据库
use test_db;
3.查看数据库中的所有表
show tables;
4.查看hive中的数据库列表
show databases;
5.建立外部表
CREATE EXTERNAL TABLE test_table(
user_id STRING,
name STRING,
age STRING,
gender STRING)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
6.删除表
drop table test_table;
7.退出hive
quit;
exit;
8.查看表的表格设计
desc test_table;
9.复制其他表格中的内容到新表
create table sub_data as select * from default.test_table;
10.统计hive表中数据条数
select count(*) from test_table