当前位置:网站首页>[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
边栏推荐
- Those high-frequency written tests and interview questions in [Jianzhi offer & Niuke 101] - linked list
- 運維管理系統,人性化操作體驗
- Eigen矩阵运算库快速上手
- Caesar
- ctfshow-web355,356(SSRF)
- 关于图灵测试和中文屋Chinese room的理解
- [programming training] delete public characters (hash mapping) + team competition (greedy)
- 华泰证券开户是安全可靠的么?怎么开华泰证券账户
- C语言实现【扫雷游戏】完整版(实现源码)
- The database is locked. Is there a solution
猜你喜欢
H5 页面设置了字体的粗细样式,但是在华为手机里微信打开访问样式不生效?
2022 test question bank and simulation test of tea master (primary) operation certificate
2022 tea master (intermediate) recurrent training question bank and answers
The database is locked. Is there a solution
Image style migration cyclegan principle
【剑指offer&牛客101】中那些高频笔试,面试题——链表篇
C language implementation [minesweeping game] full version (implementation source code)
C language implementation [Sanzi chess game] (step analysis and implementation source code)
Paging in servlets and JSPS
redisson使用全解——redisson官方文档+注释(上篇)
随机推荐
【编程强训3】字符串中找出连续最长的数字串+数组中出现次数超过一半的数字
【mysql学习笔记27】存储过程
Is the account opening of GF Securities safe and reliable? How to open GF Securities Account
继妹变继母,儿子与自己断绝关系,世界首富马斯克,为何这么惨?
运维面临挑战?智能运维管理系统来帮您
【无标题】
C language implementation [minesweeping game] full version (implementation source code)
[R language] two /n data merge functions
[programming training 2] sorting subsequence + inverted string
【技能】创建.bat快速打开网页
TodoList经典案例①
电脑有网络,但所有浏览器网页都打不开,是怎么回事?
华泰证券开户是安全可靠的么?怎么开华泰证券账户
C# Newtonsoft.Json中JObject的使用
【mysql学习笔记25】sql语句优化
redisson使用全解——redisson官方文档+注释(上篇)
组件的自定义事件②
论文学习——水文时间序列相似性查询的分析与研究
1286_FreeRTOS的任务优先级设置实现分析
【推荐系统】美团外卖推荐场景的深度位置交互网络DPIN的突破与畅想