标签:har value .com 定义 name 隐藏 table tab ssi
定义
一、创建视图
1、语法 create [or replace ] [ temp | temporary ] view name [(column_name [,...])] as query
2、实例:创建一个可以隐藏password的视图:
postgres=# create table users( id int, user_name varchar(40), password varchar(256), user_email text, user_mark text ); postgres=# create view vw_users as select id, user_name,user_email,user_mark from users; CREATE VIEW
3、也可以使用temp 或者 temporary 关键字来创建视图,当session结束时,视图消失:
postgres=# create temp view vw_users as select id,user_name,user_email,user_mark from users; CREATE VIEW postgres=# insert into users values(1,‘a‘,‘123455‘,‘test@163.com‘); INSERT 0 1
\q 退出再登陆后消失
4、视图也能为查询的各列定义另一个名称。列如将原来表中的id、user_name、user_email、user_mark等列名重新定义为no、name、email、mark,
postgres=# create view vm_users(no,name,email,mark) as select id,user_name, postgres-# user_email,user_mark from users; CREATE VIEW postgres=# select * from vm_users; no | name | email | mark ----+------+--------------+------ 1 | a | test@163.com | (1 row) postgres=#
二、可更新视图
标签:har value .com 定义 name 隐藏 table tab ssi
原文地址:https://www.cnblogs.com/sunshine-long/p/9052265.html