Difference between "TOP" and "SAMPLE" in TeraData SQL

Viewed 23733

What is the difference between "TOP" and "SAMPLE" in TeraData SQL? Are they the same?

2 Answers

‘Sample’ command:

Sel * from tablename
sample 100

That will give you a sample of 100 different records from the table. The SAMPLE command will give DIFFERENT results each time you run it.

TOP command:

sel top 100 * from tablename;

This will give the first 100 rows of the table. The TOP command will give you THE SAME results each time you run it.

Related