您的位置:首页 > 博客中心 > 数据库 >

15、SQL基础整理(视图)

时间:2022-03-14 03:50

视图

即虚拟表

系统-右键-新建视图

gxlsystem.com,布布扣

 gxlsystem.com,布布扣

 

编辑前200行

 gxlsystem.com,布布扣

 

select *from studentscore

 gxlsystem.com,布布扣

 

代码创建法:

create view studentscore

as

select student.sno,sname,ssex,sbirthday,class,cno,degree from student

join score on student.Sno=score.sno

 

删除视图:

drop view studentscore

 

修改视图:

alter view cts

as

select student.sno,score.cno,sname,sbirthday,class,cname,tno,degree from student,course,score

where score.Cno=course.Cno and score.sno=student.Sno

 

Notice

1、一个视图不能引用另一视图(不能用join链接)

2、order by前面必须写上top

热门排行

今日推荐

热门手游