Select top N records in SQL / Teradata

visibility 2,478 access_time 2 years ago languageEnglish timeline Stats
timeline Stats
Page index 2.19
more_horiz

In different databases, the syntax of selecting top N records are slightly different. They may also differ from ISO standards.

In Teradata, use TOP N or SAMPLE to retrieve N records from the table. Remember to replace N with one actual number. As Teradata is a distributed system, SAMPLE will still scan all the records.

Code snippet

SELECT TOP N * FROM TableName;
SELECT * FROM TableName SAMPLE N;
info Last modified by Administrator 2 years ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

More from Kontext
Convert TimeStamp to Date in Teradata
visibility 17,357
thumb_up 0
access_time 2 years ago
Read and parse JSON in SQL / Teradata
visibility 1,576
thumb_up 2
access_time 4 years ago