美文网首页
hive中常用命令(建表、删表等)

hive中常用命令(建表、删表等)

作者: 小辣椒不怕辣 | 来源:发表于2019-01-07 23:33 被阅读0次

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

相关文章

网友评论

      本文标题:hive中常用命令(建表、删表等)

      本文链接:https://www.haomeiwen.com/subject/rijmrqtx.html