Select number of records from a table using TOP function in Teradata

Some time we wants to fetch sample rows from the table. If we use SELECT * in the query,it will bring all the rows from the table.

TOP n operator in Teradata:

Instead of fetching all rows from the table,we can use TOP n operator in the SELECT query and It will produce random ‘N’ rows from the table.

TOP n operator syntax:

N= Number of rows needed.

Example for TOP n operator:

Table Name: Customer (Total number of records = 7)

Since TOP 3 is mentioned in the SELECT query, It will return only 3 records from the customer table.


Similarly we can get the required number of sample records by using TOP n operator in Teradata.

Select top 10  or top 100 rows in Teradata

Recommended Articles