hive数据库操作——hive命令行

本文主要介绍通过hive命令行对hive数据库进行操作。

好,下面上货。
1、显示所有数据库
show databases;
hive数据库操作——hive命令行

模糊匹配数据库名称
show databases like 'd*';
hive数据库操作——hive命令行

2、数据库新增
create database if not exists xytestdatabase;
hive数据库操作——hive命令行

新增数据库后,能够在hdfs中查询到数据库的位置
hive数据库操作——hive命令行
hive数据库操作——hive命令行

3、查看数据库的具体信息
describe database xytestdatabase;
hive数据库操作——hive命令行

或者使用更详细的方式。
describe database extended xytestdatabase;
hive数据库操作——hive命令行

4、删除数据库
drop database if exists xytestdatabase;
hive数据库操作——hive命令行


删除数据库的时候有一点需要注意,如果数据库中是有表的,那么是不允许删除的,如果想要删除,那么想要使用如下命令:
drop database if exists xytestdatabase cascade;

注意:在hive中是不能对数据库进行修改的,无论是数据的名称,还是数据库的存储路径都是不能修改的。


相关文章:

  • 2022-02-27
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
  • 2021-11-11
  • 2021-11-05
  • 2021-09-12
  • 2021-12-14
猜你喜欢
  • 2022-01-11
  • 2021-07-14
  • 2021-05-24
  • 2021-11-03
  • 2021-06-06
  • 2021-10-08
  • 2022-02-11
相关资源
相似解决方案