Usage

ビューは、virtual schemasにのみ作成することができ、例えばデフォルトスキーマviewsに作成することができます。Once created, they will appear in the respective virtual schemas section of the Data Virtuality Studio. CREATE OR REPLACEを使用すると、既存のView が置き換えられます。ビュー定義(フォーマットやコメントを含む)が変更されていない場合、既存のビューは置き換えられません。

CREATE [OR REPLACE] [PRIVATE] VIEW <schema_name>.<viewname>[column_name column_type, ..., PRIMARY KEY(column_name)] AS queryExpression;;

Syntax Rules

  • PRIMARY KEYこれはテーブル内の各レコードを一意に識別するもので、一意な値を含む必要があり、NULLにすることはできません;
  • queryExpressionの列数は変更しないでください。

The PRIVATE keyword is reserved for internal use and should not be specified for user-defined views.

Examples

CREATE VIEW views.countryregion AS
SELECT *
FROM adventureworks.countryregion ;;
 
CREATE VIEW virtual_schema_name.creditcard AS
SELECT number, expiryDate, ccv
FROM adventureworks.creditcard ;;
 
CREATE VIEW virtual_schema_name.creditcard(number integer, expiryDate date, PRIMARY KEY(number)) AS
SELECT number, expiryDate
FROM adventureworks.creditcard ;;

State

View が作成されると、以下のいずれかの状態になります:

State

Description

READY

The view can be used

WARNING

The view can be used, but the backing data source uses a stored copy of the metadata.

(情報) Most probably, the data source was unavailable when the Data Virtuality Server started or during the last metadata refresh. To fix this, it is usually enough to refresh the underlying data source

FAILED

The view failed to load. A view in this state cannot be used