Raymond Raymond

Select top N records in SQL / Teradata

event 2019-11-18 visibility 9,008 comment 0 insights toc
more_vert
insights Stats
toc Table of contents

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;
More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts