TOP n and TOP m PERCENT Clause Usage - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
imq1591724555718.ditamap
dita:ditavalPath
imq1591724555718.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

You can restrict a view to only n rows or m percent of the rows in an underlying base table by specifying a TOP n or TOP m PERCENT clause, respectively, in the view definition. This option provides a fast method to obtain a restricted, statistically non-random sample of table rows without scanning the entire table. For example, you might create a view that specifies only the top 10 rows, or only the top 10 percent of the rows, from an orders table.