Teradata ViewsViews are database objects that are built by the query. Views can be created using a single table or multiple tables by way of joining. Their definition is stored permanently in a data dictionary, but they don't save a copy. Data for the view is built dynamically. A view may contain a subset of the table's rows or a subset of columns. Create a ViewViews are created using a special form of Data Definition Language (DDL). The CREATE requests a new VIEW, provides the name and the SELECT for the view. It is suggested the name of the view either start with "v_" or end with "_v" to identify it as a view name. That way, it is visibly obvious to people that this is a view and not a table. The name of the view must be unique from the names of other objects in the database. The CREATE VIEW verifies that the name does not already exist and returns an error if it does. Syntax Following is the syntax for creating a view.
NOTE
Example Consider the following Employee table.
The following example creates a view on the Employee table. Using ViewsWe can use a regular SELECT statement to retrieve data from Views. Example The following example retrieves the records from Employee_View; Modifying ViewsA current view can be modified using the REPLACE VIEW statement. REPLACE VIEW redefines an existing view or, if the specified view does not exist, it creates a new view with the specified name. Syntax Following is the syntax to modify a view. Example The following example modifies the view Employee_View for adding additional columns. Drop ViewA current view can be dropped using the DROP VIEW statement. Syntax Following is the syntax of DROP VIEW. Example Following is an example to drop the view Employee_View. Advantages of ViewsHere are some advantages of using Views in Teradata, such as:
Next TopicTeradata Macros |