当前位置:网站首页>Mysql视图
Mysql视图
2022-08-02 12:56:00 【GSX_MI】
- 视图是一个虚拟表,其内容由查询定义。同真实的表一样,视图包含一系列带有名称的列和行数据。视图的数据变化会影响到基表,基表的数据变化也会影响到视图。
1.基本使用
(1)创建视图
create view 视图名 as select语句;
(2)案例

(3)子表,也有对应的空间和文件
- 查询出来的内容形成一个新的表,只在内存中存在;
- 只有表结构,没有数据。

(4)修改了视图,对基表数据有影响

(5)修改了基表,对视图有影响

(6)删除视图

2.视图规则与限制
- 与表一样,必须唯一命名(不能出现同名视图或表名)
- 创建视图数目无限制,但要考虑复杂查询创建为视图之后的性能影响
- 视图不能添加索引,也不能有关联的触发器或者默认值
- 视图可以提高安全性,必须具有足够的访问权限
- order by 可以用在视图中,但是如果从该视图检索数据 select 中也含有 order by ,那么该视图中的order by 将被覆盖
- 视图可以和表一起使用
- 视图中的数据来源于基表
边栏推荐
- 图神经网络(GNN)的简介「建议收藏」
- Wireless vibrating wire acquisition instrument remote modification method
- photo-sphere-viewer中文文档
- Taurus.MVC V3.0.3 microservice open source framework released: Make the evolution of .NET architecture easier in large concurrency.
- openGauss数据库基本操作(超详细)
- 如何关闭开启硬件加速[通俗易懂]
- 0801~ Interview questions
- [b01lers2020]Welcome to Earth-1
- Basic operations of openGauss database (super detailed)
- 冰箱“扩容”的战事,在今夏格外猛烈
猜你喜欢
随机推荐
RestTemplate 使用:设置请求头、请求体
Detailed explanation of network flow (what information can the flow network diagram generally reflect)
SQL Server如何建表
php字符串的截取方式
Ribbon负载均衡的深度分析和使用
Singleton pattern of seven kinds of writing, you know?
FreeRTOS中名称规范
uniapp/小程序 onload方法每次打开页面都执行解读
Seata Distributed Transaction
Intouch System Platform IDE-1
To eliminate air bubbles to save the mushroom h5 small game source code
Openlayers Quick Start Tutorial
[b01lers2020]Welcome to Earth-1
Wireless vibrating wire acquisition instrument remote modification method
svg balloon rises explosion js special effect
不错的射击类js小游戏源码
自定义mvc框架复习
js true 3d histogram plugin
Four seasons of trees realized by svg
First acquaintance of scrapy framework 1









