Chapter 31 - View Functions

“It is easier to go down a hill than up it, but the view is much better at the top.”

-Arnold Bennett

Creating a Simple View

images

CREATE View Employee_V  AS
SELECT      Employee_No
           ,First_Name
           ,Last_Name
           ,Dept_No
FROM Employee_Table ; 

The purposes of views are to restrict access to certain columns, derive columns or Join Tables, and to restrict access to certain rows (if a WHERE clause is used).

Basic Rules for Views

1. No ORDER BY inside the View CREATE (some exceptions exist)

2. All Aggregation needs to have an ALIAS

3. Any Derived columns (such as Math) needs an ALIAS

 

Above, are the basic rules of Views with excellent ...

Get Tera-Tom's 1000 Page e-Book on Teradata Architecture and SQL, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.