数据库(九)

视图 

视图是从一个或多个表或视图中导出的表,其结构和数据是建立在对表的查询基础上的。所以试图不是真实存在的基础表,而是一张虚表视图,所对应的数据并不实际的视图结构存储在数据库中,而是存储在视图所引用的表中。通过视图看到的数据只是存放在基本表中的数据。

--视图查询
select *from studentScore
select Sname,Ssex,Sbirthday from studentScore

--代码创建视图
create view studentscore
as
select student.Sno,Sname,Ssex,Sbirthday,Class,Cno,Degree from student
join Score on student.Sno=Score.Sno
go
select *from studentscore

原文地址:https://www.cnblogs.com/mxx0426/p/4095388.html