当前位置:网站首页>[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
边栏推荐
- 【目标检测】目标检测界的扛把子YOLOv5(原理详解+修炼指南)
- Reply and explanation on issues related to "online training of network security education in 2022"
- [software] phantomjs screenshot
- 手机开户选哪个证券公司比较好,哪个更安全
- kubernetes资源对象介绍及常用命令(二)
- Félicitations pour l'inscription réussie de wuxinghe
- How to create an exclusive vs Code theme
- 【剑指offer&牛客101】中那些高频笔试,面试题——链表篇
- 1286_FreeRTOS的任务优先级设置实现分析
- 华泰证券开户是安全可靠的么?怎么开华泰证券账户
猜你喜欢

2022 test question bank and simulation test of tea master (primary) operation certificate
![[target detection] yolov5, the shoulder of target detection (detailed principle + Training Guide)](/img/47/80d2e92ea7347cc5c7410194d5bf2e.png)
[target detection] yolov5, the shoulder of target detection (detailed principle + Training Guide)

热烈祝贺五行和合酒成功挂牌
![[chapter 72 of the flutter problem series] a solution to the problem that pictures taken in the flutter using the camera plug-in are stretched](/img/8d/cf259b9bb8574aa1842280c9661d1e.jpg)
[chapter 72 of the flutter problem series] a solution to the problem that pictures taken in the flutter using the camera plug-in are stretched

2022 mobile crane driver test exercises and online simulation test

2022 tea master (intermediate) recurrent training question bank and answers

atguigu----脚手架--02-使用脚手架(2)

【剑指offer&牛客101】中那些高频笔试,面试题——链表篇

How to create an exclusive vs Code theme

redisson使用全解——redisson官方文档+注释(上篇)
随机推荐
Summary of the concept and advantages of 5g massive MIMO
Detailed explanation of weback5 basic configuration
Vscode automatically formats code according to eslint specification
[R language] two /n data merge functions
運維管理系統,人性化操作體驗
Challenges faced by operation and maintenance? Intelligent operation and maintenance management system to help you
【Flutter 问题系列第 72 篇】在 Flutter 中使用 Camera 插件拍的图片被拉伸问题的解决方案
Autosar 学习记录(1) – EcuM_Init
Inftnews | from "avalanche" to Baidu "xirang", 16 major events of the meta universe in 30 years
[programming training 2] sorting subsequence + inverted string
手机开户选哪个证券公司比较好,哪个更安全
【编程强训2】排序子序列+倒置字符串
Stepsister becomes stepmother, son breaks off relationship with himself, and musk, the world's richest man, why is it so miserable?
2022 operation of refrigeration and air conditioning equipment operation of national question bank simulated examination platform
C# Newtonsoft.Json中JObject的使用
How to create an exclusive vs Code theme
赌上了绩效,赢了公司CTO,我要搭DevOps平台!
[the path of system analysts] Chapter 5: software engineering of double disk (reverse clean room and Model Driven Development)
Cadence OrCAD Capture “网络名”相同,但是未连接或连接错误的解放方案之nodename的用法
【mysql学习笔记27】存储过程