Teradata Simple Views and Complex Views

A view is a part of base table or base tables. Many reasons we can use Views.

1. Views with aggregate data we can use
2. Reduce complexity, so that less SQL skill is required to use views
3. Like any other base table, we can not Alter views
4. We use REPLACE option to alter views

View can be dropped:

DROP VIEW view_name;

Before going into indepth of Views, some rules are there to create View:
  • Should NOT use ORDER BY either on a view or base table in CREATE VIEW query
  • Indexes- we shoud not
  • Always give Alias to Aggregtate/Derived column names

Simple View: A view is created from a base table without any functions or Joins

Complex View: A view is created with Aggregate functions, Joins, Derived data, DISTINCT, GROUP BY will be treated as Complex view.


Popular posts from this blog

SQL for Quantile Function in Teradata

3 Uses of SAMPLE function in Teradata

All You Need NULL Value Functions