Define database views

Database views are searchable database constructs based on a native SQL query with a SELECT statement or an Alfabet query. A database view is like a virtual table represented by the native SQL query or Alfabet query. The query syntax used to define database views in native SQL on the database server level is:

For the Alfabet database, database views can be created and maintained in the tool Alfabet Expand without the need to directly access and configure the database server.

A configuration object Database View is available for defining the database view. The name of the database view table and the SELECT statement for the content of the database view are defined in separate attributes of the configuration object. When the configuration is saved, the CREATE_VIEW statement for creating the view is automatically built and executed based on the defined information.

The content of the table resulting from the output of the native SQL query or Alfabet query defined as ViewContentDefinition is not stored in the database. Instead, the native SQL query is executed each time data is requested from the database view table defined with ViewTableName by any other native SQL query or other mechanism targeting the database view table. Targeting the database view table in a native SQL query is done in the same way as targeting a standard database table. In the Alfabet query language targeting of a database view table is not supported.

Database views do not store data and therefore take up very little database space. They offer the following advantages for building queries for example for reporting:

The content of a database view can either be defined as a native SQL query or an Alfabet query. The result dataset is built as follows depending on the type of query defined: