n No Indexes should be created on Views,
n If you specify a TOP n or TOP m PERCENT option, then only you can specify an ORDER BY clause otherwise NO.
n When referencing multiple tables make use of indexes for faster access.
Here is the syntax:
CREATE VIEW <view-name> [( <column alias name1>,... ) ] AS
LOCK [TABLE | VIEW | ROW ] FOR | IN [READ | WRITE | ACCESS ] MODE NOWAIT SELECT [DISTINCT | ALL ] TOP <n|m> PERCENT [WITH TIES]
<column-name> [AS <alias-name> ]
[ , <column-name> [AS <alias-name> ] ]
FROM <table-name> <JOIN CONDITION | SUB QUERY>
[ WHERE <search condition>
GROUP BY <grouping specification> HAVING <condition >]
[ WITH CHECK OPTION ] ORDER BY <expression> [ASE | DESC];
Use the clause WITH CHECK OPTION for “updatable Views” which helps in restricting the rows that can be updated in the table by an INSERT or UPDATE statement to satisfy the condition in WHERE clause. In other words, use this clause if you want to insert rows that satisfies the WHERE clause, present in the View definition. If you do not specify this clause, rows would be inserted ignoring the WHERE clause but base table checks and constraints remain enforced.
Popularity: 38% [?]
Our Random Articles
- New Year Wishes 2010
- New Year Wishes
- How to use EXTRACT function with date and time columns
- How to Post on a Separate/New Page in WordPress
- Usage of Macro in Teradata
More Links




8 Comments
How do I see the select statement of a view in Teradata?
How do I see the select statement for the view?
SHOW SELECT * FROM
This would give results as follows
Replace View. AS Select * from .
Hi,
While creating a view , i had specified certain comments and created the view .However when i gave a show view , the comments did not appear.Can you please tell me why is this so ?
You can check the Select with this:
Show view XXX;
XXXX = View you can check….
You must put this:
show view XXXX.
XXXX = Your view.
Hi,
For eg :
Thank you for the reply however my prob is still not solved
If i create a view as :
replace view TEST as
/*Query to fetch emp with sal>1000*/
sel* from table1
UNION
/*Query to fetch emp with desig=A*/
sel* from table2
;
Here the comments specified in /**/ do not appear when i give a show view after creating the view.Please let me know why this is happening.
Hi Sri,
You might have created the view in BTEQ, create the same view in SQL Assistant you will get the comments along with the view structure.
Popular Articles