# 视图view

  • 视图是虚拟存在的表,并非实际存在
  • 对视图的操作需要相应的权限
  • 基本操作
-- create
mysql> create or replace view test_view as 
select a.i  from auto_incre_demo as a 
where a.name = '1';

Query OK, 0 rows affected (0.01 sec)

-- 查询视图的时候和普通查表差不多
mysql> select * from test_view;

-- drop
mysql> drop view test_view;


  • 不可更新的视图
    • 包含聚合函数如sum()
    • 常量视图
    • select中包含子查询
Last Updated: 2020/3/1 下午7:17:59