当前位置:网站首页>Basic operations of MySQL view
Basic operations of MySQL view
2022-07-27 18:37:00 【zkkkkkkkkkkkkk】
mysql For an introduction to views and how to create them, please see : A case study mysql View . This chapter mainly records the modification of view 、 Delete and display view syntax .
Catalog
One 、 Create view
Please have a look at : A case study mysql View
Two 、 Modify the view
grammar :alter view view_name as Modify the content
-- grammar alter view view_name as
-- Content
alter view sms as
select s_id,s_name
from student
translate : Will be with sms The content of the named view is modified to student In the table s_id and s_name3、 ... and 、 Delete view
grammar :drop view view_name( Collocation if exists Use , grammar :drop view if exists view_name)
-- grammar 1 drop view view_name
drop view sms
-- grammar 2 drop view if exists view_name
drop view if exists sms
Four 、 Update the view
The same view can also update data like a real table , But here's the thing Update the data in the view , It is also equivalent to updating the real table
grammar :UPDATE view_name set update_columns where Conditions
# Create a view student table
create view view_student as
select *
from student
-- Update the view
update view_student set s_id = 888 where s_name = ' Zhang San '
Put the above sql After execution , Let's open two more tables ( View table view_student, True table student). We will find that these two tables meet the above where Conditions will change , In other words, updating the view will affect the original data in the real table .
The following is a screenshot of the results before and after executing the update view statement :
original student and view_student After the update student After the update view_student

5、 ... and 、 Show the view
grammar :show create view view_name( Used to query the details of a view )
-- grammar :show create view view_name
show create view sms
The output is shown in the following figure :

边栏推荐
- [MIT 6.S081] Lab 5: xv6 lazy page allocation
- 微信小程序获取手机号
- Deep learning - VIDEO behavior recognition: paper reading - two stream revolutionary networks for action recognition in videos
- Here comes the first 5g SOC of MediaTek! A77+g77+apu3.0, officially released on November 26!
- 虚拟偶像的歌声原来是这样生成的!
- Idea packaging war package and war package location
- 2021.7.12 internal and external connection of notes
- 2021.8.1笔记 数据库设计
- 2021.8.1 Notes database design
- Common commands of database 1
猜你喜欢

「MySQL那些事」一文详解索引原理
![[MIT 6.S081] Lab 7: Multithreading](/img/f4/26e513fb8678a88cfba29c1a636b37.png)
[MIT 6.S081] Lab 7: Multithreading

Deep learning: GCN (graph convolution neural network) theory learning summary

1. OpenCV image basic operation

Installation and deployment of zabbix6.0

2021.7.22 note constraints

Technology sharing | quick intercom integrated dispatching system

Super practical! After reading the kubernetes study notes hidden by Alibaba P9, call NB directly
![[mit 6.s081] LEC 10: multiprocessors and locking notes](/img/62/ca6362830321feaf450865132cdea9.png)
[mit 6.s081] LEC 10: multiprocessors and locking notes

Common commands of database 2
随机推荐
2021.8.1笔记 数据库设计
[MIT 6.S081] Lab 6: Copy-on-Write Fork for xv6
2021.7.12笔记 内外连接
MySQL 主从复制数据不一致,怎么办?
2021.7.18 notes MySQL data type
Deep learning: GCN (graph convolution neural network) theory learning summary
Uniapp has no effect on the page selector on the app side
MySQL code database creation parking management system foreign key
[MIT 6.S081] Lab 3: page tables
2021.7.28 notes
Log4j 史诗级漏洞,京东这样的大厂都中招了
Nowcoder (5 choices)
2021.7.17 notes MySQL other commands
OEM "made in the United States", domestic security equipment has been installed on the U.S. aircraft carrier!
NVIDIA released the world's smallest edge AI supercomputing: 21tops computing power, power consumption is only 10W!
The first PCIe 5.0 SSD master of Jiangsu Huacun: TSMC 12NM process, mass production in 2020
Solve the problem that reids cannot be accessed by other IPS
2021.8.7笔记 servlet
Disassembly of Xiaomi cc9 Pro: the cost of rear five shots is several times that of Xiaolong 855!
File path read