当前位置:网站首页>MySQL Chapter 5 Summary
MySQL Chapter 5 Summary
2022-06-26 10:21:00 【m0_ sixty-one million nine hundred and sixty-one thousand eight】
Create view
Basic grammar
have access to CREATE VIEW Statement to create the view .
The syntax is as follows :
CREATE VIEW < View name > AS <SELECT sentence >
The grammar is as follows .
< View name >: Specifies the name of the view . The name must be unique in the database , Cannot have the same name as another table or view .
<SELECT sentence >: Specifies the time to create the view SELECT sentence , It can be used to query multiple base tables or source views .
For creating... In a view SELECT Statement has the following limitations :
In addition to having CREATE VIEW Out of authority , It also has relevant permissions for the basic tables and other views involved in the operation . SELECT Statements cannot reference system or user variables .
SELECT Statement cannot contain FROM Subquery in Clause . SELECT Statement cannot reference preprocessing statement parameters .
The table or view referenced in the view definition must exist . however , After creating the view , You can delete tables or views that define references . You can use CHECK TABLE Statement to check the view definition for such problems .
View definitions allow the use of ORDER BY sentence , But if you choose from a specific view , This view uses its own ORDER BY sentence , Then... In the view definition ORDER BY Will be ignored .
Cannot reference... In view definition TEMPORARY surface ( A temporary table ), Can't create TEMPORARY View .
WITH CHECK OPTION It means , When modifying the view , Check whether the inserted data conforms to WHERE Set the conditions .
Create a view based on a single table
MySQL You can create views on a single data table .
Be careful :DESCRIBE In general, it can be abbreviated as DESC, Enter the execution result and input of this command DESCRIBE It's the same .
Modify the view
have access to ALTER VIEW Statement to modify the existing view .
The syntax is as follows :
ALTER VIEW < View name > AS <SELECT sentence >
The grammar is as follows :
< View name >: Specifies the name of the view . The name must be unique in the database , Cannot have the same name as another table or view .
<SELECT sentence >: Specifies the time to create the view SELECT sentence , It can be used to query multiple base tables or source views .
It should be noted that , about ALTER VIEW Use of statements , The user is required to have a view specific CREATE VIEW and DROP jurisdiction , And by
SELECT Some permissions on each column selected by the statement .
Modify the definition of the view , Except through ALTER VIEW Outside , You can also use DROP VIEW Statement to delete the view first , Reuse CREATE VIEW Statement to implement .
Update data table with view
The view is a virtual table , The actual data comes from the basic table , So by inserting 、 Modify and delete operations update the data in the view , It is essentially updating the data of the basic table referenced by the view .
Basic grammar
have access to ALTER VIEW Statement to modify the existing view .
The syntax is as follows :
ALTER VIEW < View name > AS <SELECT sentence >
The grammar is as follows :
< View name >: Specifies the name of the view . The name must be unique in the database , Cannot have the same name as another table or view .
<SELECT sentence >: Specifies the time to create the view SELECT sentence , It can be used to query multiple base tables or source views .
It should be noted that , about ALTER VIEW Use of statements , The user is required to have a view specific CREATE VIEW and DROP jurisdiction , And by SELECT Some permissions on each column selected by the statement .
Modify the definition of the view , Except through ALTER VIEW Outside , You can also use DROP VIEW Statement to delete the view first , Reuse CREATE VIEW Statement to implement .
Some views are updatable . in other words , have access to UPDATE、DELETE or INSERT Wait for the statement to update the content of the basic table . For updatable views , There must be a one-to-one relationship between the rows in the view and the rows in the base table .
Delete view
have access to DROP VIEW Statement to delete the view .
The syntax is as follows :
DROP VIEW < View name 1> [ , < View name 2> …]
< View name > Specify the name of the view to delete .DROP VIEW Statement can delete multiple views at once , But you must have... On each view DROP jurisdiction .
边栏推荐
- Mysql database operation commands (constantly updated)
- Allocation de mémoire tas lors de la création d'objets
- Index summary of blog articles -- Industrial Internet
- What is LSP
- Procedure Call Standard
- MySQL第五章总结
- The basis of C language grammar -- learning of local variables and storage categories, global variables and storage categories, and macro definitions
- Standard implementation of streaming layout: a guide to flexboxlayout
- The IE mode tab of Microsoft edge browser is stuck, which has been fixed by rolling back the update
- DBSCAN
猜你喜欢

Small example of SSM project, detailed tutorial of SSM integration

微软 Edge 浏览器 IE 模式标签页出现卡死情况,已通过回滚更新修复

全渠道、多场景、跨平台,App如何借助数据分析渠道流量

Establishment of smart dialogue platform for wechat official account

118. 杨辉三角

定制拦截器

Basic string operations in C

Hcia-dhcp experiment

Day 3 array, pre post, character space, keyword and address pointer

What is in the method area - class file, class file constant pool, runtime constant pool
随机推荐
The basis of C language grammar -- factoring by function applet
【Leetcode】76. Minimum covering substring
Global and Chinese market of aluminum sunshade systems 2022-2028: Research Report on technology, participants, trends, market size and share
What is the web SSH service port of wgcloud
Leetcode intermediate node of linked list
Redis master-slave replication in win10 system
echo $?
MySQL第四章总结
Global and Chinese market of recycled paper 2022-2028: Research Report on technology, participants, trends, market size and share
echo $?
The basis of C language grammar -- function nesting, Fibonacci sum of recursive applet and factorial
Configuration internationale
MySQL项目8总结
Selection of webrtc video codec type VP8 H264 or other? (openh264 encoding, ffmpeg decoding)
How do technicians send notifications?
字符串常量池、class常量池和运行时常量池
LSP 是什么
libmagic 介绍
Tensorflow dynamically allocates video memory
Full introduction to flexboxlayout (Google official flexible implementation of flow layout control)