"CREATE VIEW" SQL 11/05/95 日本語PostgreSQL 日本語PostgreSQL

名称

create view - 仮想クラスを作ります

形式

create view view_name as
	select expression1 [as attr_name1]
	{, expression_i [as attr_namei]}
	[from from.last]
	[where qual]
    

説明

create view はあるクラスのVIEW表を定義します。この VIEW 表は物理的にはありません。その代わり [STON90] にあるように、ルールシステムが VIEW 表の処理に使用されます。つまり、問い合わせのリライト検索ルールが自動的に生成されて、VIEW 表への検索の実行がサポートされます。それで、ユーザは VIEW 表への更新処理を指定するのに、望むだけの更新ルールを加えることができるのです。この点に関しては [STON90] を参照してください。

--
-- 玩具売場の従業員からなる VIEW 表を作成します
--
create view toyemp as
  	select e.name
	from emp e
	where e.dept = 'toy'
    
--
-- toyemp に対する削除のセマンティックを指定します
--
create rule example1 as
	on delete to toyemp
	do instead delete emp
	where emp.oid = current.oid
    

参照

table(l) , rule(l) ,