成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

CREATE VIEW 中文man頁面

系統
CREATE VIEW 定義一個查詢的視圖。 這個視圖不是物理上實際存在(于磁盤)的。具體的說,自動生成一個改寫索引規(guī)則(一個 ON SELECT 規(guī)則)的查詢用以支持在視圖上的檢索。

NAME

CREATE VIEW - 定義一個視圖

SYNOPSIS

CREATE [ OR REPLACE ] VIEW name [ ( column_name [, ...] ) ] AS query

DESCRIPTION 描述

CREATE VIEW 定義一個查詢的視圖。 這個視圖不是物理上實際存在(于磁盤)的。具體的說,自動生成一個改寫索引規(guī)則(一個 ON SELECT 規(guī)則)的查詢用以支持在視圖上的檢索。

CREATE OR REPLACE VIEW 類似,不過是如果一個同名的視圖已經存在,那么就替換它。 你只能用一個生成相同字段的新查詢替換一個視圖(也就是說,同樣字段名和數據類型)。


 如果給出了一個模式名(比如,CREATE VIEW myschema.myview ...),那么該視圖是在指定的模式中創(chuàng)建的。 否則它是在當前模式中創(chuàng)建的。 該視圖名字必需和同一模式中任何其它視圖,表,序列或者索引的名字不同。  

PARAMETERS 參數

name

 所要創(chuàng)建的視圖名稱(可以有模式修飾)。
column_name

 一個可選的名字列表,用于當作視圖的字段名。如果沒有給出, 字段名取自查詢。
query

 一個將為視圖提供行和列的查詢(也就是一條 SELECT 語句)。


 請參閱 SELECT [select(7)] 獲取有效查詢的更多信息。

NOTES 注意


 目前,視圖是只讀的:系統將不允許在視圖上插入,更新,或者刪除數據。 你可以通過在視圖上創(chuàng)建把插入等動作重寫為向其它表做合適操作的規(guī)則來實現可更新視圖的效果。 更多信息詳見 CREATE RULE [create_rule(7)].


 使用 DROP VIEW 語句刪除視圖


 請注意視圖字段的名字和類型不一定是你們期望的那樣。比如,

CREATE VIEW vista AS SELECT 'Hello World';


 在兩個方面很糟糕:字段名缺省是 ?column?,并且字段的數據類型缺省是 unknown。 如果你想視圖的結果是一個字串文本,那么用類似下面這樣的東西

CREATE VIEW vista AS SELECT text 'Hello World' AS hello;


 對視圖引用的表的訪問的權限由視圖的所有者決定。 不過,在視圖里調用的函數當作他們直接從使用視圖的查詢里調用看待。 因此,視圖的用戶必須有使用視圖調用的所有函數的權限。  

EXAMPLES 例子


 創(chuàng)建一個由所有喜劇電影組成的視圖:

CREATE VIEW comedies AS
    SELECT *
    FROM films
    WHERE kind = 'Comedy';

COMPATIBILITY 兼容性


 SQL 標準為 CREATE VIEW 聲明了一些附加的功能:

CREATE VIEW name [ ( column [, ...] ) ]
    AS query
    [ WITH [ CASCADE | LOCAL ] CHECK OPTION ]


 完整的SQL命令可選的子句是:

CHECK OPTION

 這個選項用于可更新視圖。 所有對視圖的INSERT和UPDATE都要經過視圖定義條件的校驗。 (也就是說,新數據應該可以通過視圖看到。)如果沒有通過校驗,更新將被拒絕。
LOCAL

 對這個視圖進行完整性檢查。
CASCADE

 對此視圖和任何相關視圖進行完整性檢查。 在既沒有聲明 CASCADE 也沒有聲明 LOCAL 時,假設為 CASCADE。

CREATE OR REPLACE VIEW 是 PostgreSQL 的擴展。  

#p#

NAME

CREATE VIEW - define a new view

SYNOPSIS

CREATE [ OR REPLACE ] VIEW name [ ( column_name [, ...] ) ] AS query

DESCRIPTION

CREATE VIEW defines a view of a query. The view is not physically materialized. Instead, the query is run every time the view is referenced in a query.

CREATE OR REPLACE VIEW is similar, but if a view of the same name already exists, it is replaced. You can only replace a view with a new query that generates the identical set of columns (i.e., same column names and data types).

If a schema name is given (for example, CREATE VIEW myschema.myview ...) then the view is created in the specified schema. Otherwise it is created in the current schema. The view name must be distinct from the name of any other view, table, sequence, or index in the same schema.  

PARAMETERS

name
The name (optionally schema-qualified) of a view to be created.
column_name
An optional list of names to be used for columns of the view. If not given, the column names are deduced from the query.
query
A query (that is, a SELECT statement) which will provide the columns and rows of the view.

Refer to SELECT [select(7)] for more information about valid queries.

NOTES

Currently, views are read only: the system will not allow an insert, update, or delete on a view. You can get the effect of an updatable view by creating rules that rewrite inserts, etc. on the view into appropriate actions on other tables. For more information see CREATE RULE [create_rule(7)].

Use the DROP VIEW statement to drop views.

Be careful that the names and types of the view's columns will be assigned the way you want. For example,

CREATE VIEW vista AS SELECT 'Hello World';

is bad form in two ways: the column name defaults to ?column?, and the column data type defaults to unknown. If you want a string literal in a view's result, use something like

CREATE VIEW vista AS SELECT text 'Hello World' AS hello;

Access to tables referenced in the view is determined by permissions of the view owner. However, functions called in the view are treated the same as if they had been called directly from the query using the view. Therefore the user of a view must have permissions to call all functions used by the view.  

EXAMPLES

Create a view consisting of all comedy films:

CREATE VIEW comedies AS
    SELECT *
    FROM films
    WHERE kind = 'Comedy';

COMPATIBILITY

The SQL standard specifies some additional capabilities for the CREATE VIEW statement:

CREATE VIEW name [ ( column [, ...] ) ]
    AS query
    [ WITH [ CASCADE | LOCAL ] CHECK OPTION ]

The optional clauses for the full SQL command are:

CHECK OPTION
This option is to do with updatable views. All INSERT and UPDATE commands on the view will be checked to ensure data satisfy the view-defining condition (that is, the new data would be visible through the view). If they do not, the update will be rejected.
LOCAL
Check for integrity on this view.
CASCADE
Check for integrity on this view and on any dependent view. CASCADE is assumed if neither CASCADE nor LOCAL is specified.

CREATE OR REPLACE VIEW is a PostgreSQL language extension.

責任編輯:韓亞珊 來源: CMPP.net
相關推薦

2011-08-24 10:46:36

CREATE AGGR中文man

2011-08-24 10:56:32

CREATE CONV中文man

2011-08-24 11:15:24

CREATE INDE中文man

2011-08-24 13:29:20

CREATE TABL中文man

2011-08-24 13:36:25

CREATE TRIG中文man

2011-08-24 13:43:09

CREATE USER中文man

2011-08-24 13:32:56

CREATE TABL中文man

2011-08-24 10:59:19

CREATE DATA中文man

2011-08-24 11:02:11

CREATE DOMA中文man

2011-08-24 11:05:36

CREATE FUNC中文man

2011-08-24 11:10:17

CREATE GROU中文man

2011-08-24 11:18:53

CREATE LANG中文man

2011-08-24 11:23:20

CREATE OPER中文man

2011-08-24 11:31:47

CREATE RULE中文man

2011-08-24 13:23:10

CREATE SCHE中文man

2011-08-24 13:26:19

CREATE SEQU中文man

2011-08-24 13:39:44

CREATE TYPE中文man

2011-08-24 10:53:20

CREATE CONS中文man

2011-08-24 11:26:46

CREATE OPER中文man

2011-08-25 14:07:55

create_modu中文man
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 国产精品亚洲综合 | 日韩视频在线免费观看 | 男女一区二区三区 | 精品国产一区二区三区久久 | 中文在线播放 | 91丨九色丨国产在线 | 国产精品九九九 | 亚洲精品久久久久中文字幕欢迎你 | www.日韩| 麻豆av免费观看 | 久久99久久| 精品国产一区二区三区久久 | 日韩欧美三级在线 | 毛片视频网址 | 午夜精品视频一区 | 欧美一二三四成人免费视频 | 二区在线视频 | 精品一区二区三区四区视频 | 欧美久久久久 | 大象视频一区二区 | 亚洲国产aⅴ成人精品无吗 亚洲精品久久久一区二区三区 | 91高清视频在线观看 | av在线天堂| 成人精品国产一区二区4080 | 日韩在线精品视频 | 久久精品亚洲成在人线av网址 | 欧美成人免费电影 | 成人福利在线观看 | 中文在线一区 | 亚洲精品字幕 | 999在线精品| 亚洲国产成人精品久久久国产成人一区 | 国产精品久久久久久久久久久久久久 | 精品国产乱码久久久久久中文 | 午夜国产一级 | 龙珠z国语版在线观看 | 日本久久久久久 | 韩国毛片一区二区三区 | 看a网站 | 黄色精品| 亚洲网站在线观看 |