第六章:MySQL高级进阶-视图

直接学习:https://edu.csdn.net/course/play/27328/370711
视图
#1、什么是视图?视图是一个虚拟表,其内容由 select查询语句定义。和真实的表一样,视图也包含行和列,对视图的操作与对表的操作基本一致。视图中的数据是在使用视图时动态生成,视图中的数据都存储在基表中。
在这里插入图片描述

#2、示例代码如下:

create view student_view as select * from student;
update student_view set name='张晓燕2' where stu_no='2016003';
update student set name ='张晓燕' where stu_no='2016003';


create view stu_score_view as 
select A.*,B.course,B.score
from student A 
left join score B on(A.stu_no = B.stu_no);
update stu_score_view set name='张晓燕2' where stu_no='2016003';
发布了107 篇原创文章 · 获赞 6 · 访问量 968

猜你喜欢

转载自blog.csdn.net/weixin_43597208/article/details/105503819
今日推荐