sql 创建视图
展开全部
视图:view_1
基表:table_1
建立视图:create view view_2 as select * from view_1 union all select * from table1;
(假设view_1和table_1字段一样)
在数据库里怎样创建视图?
create view 视图的名字
as
select * from 表名; --写需要用到的SQL查询语句
数据库中如何创建视图?
use pubs
go
if exists(select * from sysobjects where name='NewView' and type='v')
drop view NewView
go
create view NewView
as
select * from titles
go
数据库创建视图
1
create view CountEmp
as
select 部门.deptname,count(*) as counts from 部门,员工 where 部门.deptid=员工.deptid
group by 部门.deptname
2
select deptname from CountEmp where counts>10
声明:
该资讯来自于互联网网友发布,如有侵犯您的权益请联系我们。