hive之视图

1、视图定义

  视图可以允许保存一个查询,并像对待表一样对这个查询进行操作,视图是一个逻辑结构,并不会存储数据。

2、视图的创建

  通过创建视图来限制数据访问可以用来保护信息不被随意查询。

  create table userinfo(

    id int,name string,age int,address string

  );

  create view some_userinfo as

  select id,name from userinfo;

3、删除视图

  drop view if exists userinfo;  

4、关于视图的知识

  show tables 可以查看视图,不能使用insert和load命令来操作视图。

  视图是只读的,对视图的操作都是操作元数据。

猜你喜欢

转载自www.cnblogs.com/hdc520/p/11128578.html