O'Reilly logo

Teradata SQL by Tom Coffing, Mike Larkins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 17 - 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

 

CREATE View Department_Salaries ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required