标签:order pre sch student size col into 记录 内置函数
一: 什么是视图
视图就是一个虚拟的数据表,该数据表中的数据记录是有一条查询语句的查询结果得到的。
二: 创建视图准则
1:创建视图需要考虑一下准则:
2:下列情况必须指定视图中每列的名称:
三: 创建视图
1 if (exists (select * from sys.objects where name = ‘v_stu‘)) 2 drop view v_stu 3 go 4 create view v_stu 5 as 6 select id, name, age, sex from student;
四: 修改视图
1 alter view v_stu 2 as 3 select id, name, sex from student; 4 5 alter view v_stu(编号, 名称, 性别) 6 as 7 select id, name, sex from student 8 go 9 10 select * from v_stu; 11 12 select * from information_schema.views;
五: 加密视图
if (exists (select * from sys.objects where name = ‘v_student_info‘)) drop view v_student_info go create view v_student_info with encryption --加密 as select id, name, age from student go --view_definition isnull select * from information_schema.views where table_name like‘v_stu‘;
标签:order pre sch student size col into 记录 内置函数
原文地址:https://www.cnblogs.com/loverwangshan/p/10579838.html