视图   :有联系的表之间,建立虚拟的表!

步骤  :打开数据库中  ‘选用的数据库’,右击‘视图’,选择‘新建视图’。然后填加  

‘选用的数据库’中有关联的  ‘表’,选择视图中 要显示的 ‘列’,然后关闭,保存新视图就创建完成!

--drop view       xueshengfenshu   --删除视图

--alter view     xkf                 --修改视图就是删除重写!

只有在前面使用top数字后,才可以使用 order by 。视图中不能使用聚合函数

create view xueshengfenshu

as

select student.sno,sname,ssex,sbirthday,class,score.Cno,Degree from student

join  score on student.sno=score.Sno这是完整的创建视图语句!

select *from xueshengfenshu

 

   --学生.课程,分数三个表的视图!

create view xkf

as

select student.sno,sname,ssex,sbirthday,class,score.Cno,Degree,course.Cname from student

join score on student.sno=score.Sno

join course on course.Cno=score.Cno

 

select *from xkf

 

相关文章:

  • 2021-09-18
  • 2022-12-23
  • 2021-04-17
  • 2021-08-04
  • 2021-10-06
  • 2022-01-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
  • 2022-01-31
  • 2022-12-23
  • 2022-01-15
  • 2021-05-16
相关资源
相似解决方案