当前位置:网站首页>[MySQL learning notes 26] view
[MySQL learning notes 26] view
2022-07-01 07:34:00 【yqs_ two hundred and eighty-one million eight hundred and seven】
Create view
CREATE VIEW view_name[(col1,col2,…)] AS SELECT sentence [WITH [CASCADED|LOCAL] CHECK OPTION];
Query view
Look at the create statement
show create view View name ;
Inquire about
select * from View name ;
Modify the view
Mode one
CREATE OR REPLACE VIEW view_name[(col1,col2,…)] AS SELECT sentence [WITH [CASCADED|LOCAL] CHECK OPTION];
Mode two
ALTER VIEW View name ( List ) AS SELECT sentence [WITH [CASCADED|LOCAL] CHECK OPTION];
Delete view
DROP VIEW [IF EXISTS] View name ;
Insert
Inserting a view will insert it into the original table
Check options
When using WITH CHECK OPTION Clause when creating a view ,MySQL Each row that is changing is checked through the view , For example, insert , to update , Delete , To make it conform to the definition of the view .MySQL Allows you to create a view based on another view , It also checks the rules in the dependency view for consistency . In order to determine the scope of inspection ,mysql There are two options :CASCADED and LOCAL, The default value is CASCADED.
nothing with check option when , It does not need to meet the conditions of the current view . And for the bottom view ( That is, the view for which this view is directed ), First determine whether the bottom view has with check option sentence , Some words , According to its rules (local perhaps cascaded) Handle , If not, you do not need to meet the conditions of the bottom view .
with local check option when , You need to meet the conditions of the current view . For bottom view , It is also to see whether there is a designated with check option sentence , If any, handle it accordingly , If there is none, the conditions of the bottom view need not be met .
with cascaded check option(cascaded It can be omitted ) when , You need to meet the conditions of the current view . And for all bottom view conditions , It also needs to be met together , Even if the bottom view is not defined with check option sentence .
to update
To make the view updatable , Then the columns of the view must correspond to the columns of the original table one by one
边栏推荐
- 手机开户选哪个证券公司比较好,哪个更安全
- redisson使用全解——redisson官方文档+注释(中篇)
- Kdtree notes
- Is it reliable to open an account on the compass with your mobile phone? Is there any potential safety hazard
- 组件的自定义事件①
- Unity2021-Scene视图中物体无法直接选中的解决办法
- vscode 根据 ESLint 规范自动格式化代码
- The programmer of Beipiao posted a post for help late at night: I am lonely when my girlfriend is gone
- ONES 创始人王颖奇对话《财富》(中文版):中国有没有优秀的软件?
- 微软宣布开源 (GODEL) 语言模型聊天机器人
猜你喜欢

2022制冷与空调设备运行操作国家题库模拟考试平台操作

C语言实现【扫雷游戏】完整版(实现源码)

【目标检测】目标检测界的扛把子YOLOv5(原理详解+修炼指南)

Atguigu---- scaffold --02- use scaffold (2)

C # read and write customized config file

奥迪AUDI EDI 项目中供应商需要了解哪些信息?

2022年茶艺师(中级)复训题库及答案

Discussion on several research hotspots of cvpr2022
![[programming training 2] sorting subsequence + inverted string](/img/96/87750c5d3954ef6c39cce073e8b9ae.png)
[programming training 2] sorting subsequence + inverted string

【无标题】
随机推荐
The database is locked. Is there a solution
继妹变继母,儿子与自己断绝关系,世界首富马斯克,为何这么惨?
Solution to the problem that objects in unity2021 scene view cannot be directly selected
Is it safe to do fund fixed investment on Great Wall Securities?
Those high-frequency written tests and interview questions in [Jianzhi offer & Niuke 101] - linked list
JSP - paging
[microservice openfeign] feign's log record
【编程强训3】字符串中找出连续最长的数字串+数组中出现次数超过一半的数字
LeetCode+ 71 - 75
Operation and maintenance management system, humanized operation experience
[programming compulsory training 3] find the longest consecutive number string in the string + the number that appears more than half of the times in the array
Is it safe and reliable for Huatai Securities to open an account? How to open Huatai Securities Account
Système de gestion de l'exploitation et de l'entretien, expérience d'exploitation humanisée
华为ModelArts训练Alexnet模型
电脑有网络,但所有浏览器网页都打不开,是怎么回事?
Apple账号密码自动填充
Ctfhub port scan (SSRF)
redisson使用全解——redisson官方文档+注释(中篇)
Understanding of Turing test and Chinese Room
Félicitations pour l'inscription réussie de wuxinghe