--视图,视图就是一个虚拟的表,只能查询,不能修改!只能用作查询! select *from View_1 --显示101这个学生的学生sno,sname,cno,degree create view view 2 as select Student.Sno,sname,cno,DEGREE from Student join Score on Student.Sno=Score.Sno go select Student.Sno,sname,cno,DEGREE from Student join Score on Student.Sno=Score.Sno select *from View_2 where Sno=101--视图view_2里面只选择sno,sname,cno,degree select *from(select Student.Sno,sname,cno,DEGREE from Student join Score on Student.Sno=Score.Sno) as table2 where Sno=101 --select Student.Sno,sname,cno,DEGREE from Student join Score on Student.Sno=Score.Sno当作一个临时表来用,就是子查询
时间: 2024-11-09 10:24:12