当前位置:网站首页>MySQL view explanation
MySQL view explanation
2022-06-25 18:54:00 【Wind breaking】
What is a view :mysql The view is a section of our Commonly used or complicated Of SQL Statement to save to the view . And alias the view , Each time we call, we can directly call our view method to execute SQL.
Create view :
Case code :
// Create view
CREATE VIEW View name
as
// Query statement
SELECT u.* from `user` u
LEFT JOIN user_wallet w
ON u.id = w.user_id
// Execution view
SELECT * from View name WHERE id=538View modification :
// Modify view Syntax Method 1
create or replace VIEW Modified view name
as
SELECT w.* from `user` u
LEFT JOIN user_wallet w
ON u.id = w.user_id
// Modify view Syntax Method 2
ALTER VIEW View name
as
SELECT w.* from `user` u
LEFT JOIN user_wallet w
ON u.id = w.user_idView and delete views :
// Delete view , Multiple view deletions are separated by commas
DROP VIEW v2;
// View view
// Method 1
DESC View name
// Method 2
SHOW CREATE VIEW View name View SQL Updating and inserting data :
I won't write code cases here , The syntax is the same as the usual insert update , Just change the name to the view name , When inserting and updating views, they are not only operating on view data , It also operates on the data in the original table , The problem to be noted is that if the fields in the original table are not viewed ( Our view also cannot insert data ), Then the data in the original table will appear null , If our field design cannot be empty, view me INSERT Will be abnormal .
The key functions contained in the view that cannot be updated :distinct、group by、baving、union perhaps union all
边栏推荐
- Anaconda download Tsinghua source
- JVM|运行时数据区(堆空间)
- [deeply understand tcapulusdb technology] tmonitor module architecture
- JS get data
- TCP/IP 测试题(五)
- Training of long and difficult sentences in postgraduate entrance examination day92
- Idea annotation color modification method (clear)
- Leetcode-101-symmetric binary tree
- RMAN backup database_ catalogue
- 广州华锐互动VR全景为各行各业带来发展
猜你喜欢

Current situation and development suggestions of China's green PPP project industry: the investment scale is expanding, and the existing problems need to be improved to further promote the healthy dev
![Analysis on planting area, output and import of sugarcane in Guangxi in 2021: the output of sugarcane in Guangxi accounts for 68.56% of the total output of sugarcane in China [figure]](/img/c9/f2a8c3c4ddf28d96d8bfc7bc31a4fe.jpg)
Analysis on planting area, output and import of sugarcane in Guangxi in 2021: the output of sugarcane in Guangxi accounts for 68.56% of the total output of sugarcane in China [figure]

Differences and relations between sequential table and array (easy to confuse), linear table and linked list
![[deeply understand tcapulusdb technology] cluster management operation](/img/5f/f501f557171d438f7cc9cc4427f234.png)
[deeply understand tcapulusdb technology] cluster management operation
![[in depth understanding of tcapulusdb technology] tcapulusdb model](/img/10/f94a5e1ebeaa803c754dd77351950f.png)
[in depth understanding of tcapulusdb technology] tcapulusdb model
![Current situation and trend analysis of China's glass packaging containers in 2021: the revenue of glass packaging containers increases year by year [figure]](/img/19/d93c8647415c593de9c3c959f72d64.jpg)
Current situation and trend analysis of China's glass packaging containers in 2021: the revenue of glass packaging containers increases year by year [figure]

Use pagoda to set up mqtt server

07 local method stack
![[in depth understanding of tcapulusdb technology] new models of tcapulusdb](/img/10/f94a5e1ebeaa803c754dd77351950f.png)
[in depth understanding of tcapulusdb technology] new models of tcapulusdb

华为发布两大昇腾计划 推动AI人才发展和科研创新
随机推荐
焕新出发,利尔智达天下
[in depth understanding of tcapulusdb technology] new models of tcapulusdb
Tiger DAO VC产品正式上线,Seektiger生态的有力补充
RMAN backup database_ catalogue
Analysis on development status and development suggestions of e-commerce industry in Xinjiang in 2020 [figure]
网络安全检测与防范 测试题(一)
Redis6
QQ机器人疫情查询/疫情关注等【最新beta2版本】
Kwai 616 war report was launched, and the essence was thrown away for the second time to lead the new wave. Fast brand jumped to the top 3 of the hot list
QQ robot flash forwarding / recall message forwarding [latest beta2 version]
shell-跳出循环-shift参数左移-函数的使用
Do you want to know how new investors open accounts? Is online account opening safe?
158_模型_Power BI 使用 DAX + SVG 打通制作商業圖錶幾乎所有可能
SVN介绍及使用总结
GenICam GenTL 标准 ver1.5(1)
Differences and relations between sequential table and array (easy to confuse), linear table and linked list
[deeply understand tcapulusdb technology] table management of document acceptance
Detailed explanation of oauth2 - Introduction (I)
Basic operations and basic data types of MySQL database
R语言plotly可视化:plotly可视化二维直方图等高线图(Basic 2D Histogram Contour)