当前位置:网站首页>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 将被覆盖
- 视图可以和表一起使用
- 视图中的数据来源于基表
边栏推荐
- SQL Server 2014 installation tutorial (nanny-level graphic tutorial)
- 单例模式的七种写法,你都知道吗?
- 水平垂直居中方式
- FreeRTOS--stack experiment
- Object.entries()
- How to better assess credit risk?Just watch this scorecard model live
- ETL(二):表达式组件的使用
- FreeRTOS creation tasks - dynamic creation, static creation
- FreeRTOS--栈实验
- 最小割和对偶图(未完成)
猜你喜欢
随机推荐
ThinkPHP 5.1反序列化分析和poc
[b01lers2020]Welcome to Earth-1
How to implement waterfall flow layout (what is waterfall flow layout)
linux basic command explanation
Js scratchable latex style draw plug-in
SQL Server 数据库之导入导出数据
Data Lake (2): What is Hudi
30 lines of code to realize serverless real-time health code recognition -- operation manual
FreeRTOS实验--一个函数创建多个任务
Import and export data of SQL Server database
GCC版本升级到指定版本
js true 3d histogram plugin
ETL(二):表达式组件的使用
RestTemplate 使用:设置请求头、请求体
Singleton pattern of seven kinds of writing, you know?
js半圆环加载进度动画js特效
RestTemplate use: set request header, request body
FreeRTOS--栈实验
Four seasons of trees realized by svg
第48篇-timestamp2参数分析【2022-08-01】