O'Reilly logo

Tera-Tom's 1000 Page e-Book on Teradata Architecture and SQL, 2nd Edition by Tom Coffing, William Coffing

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 39 - Sample

“The universe extends beyond the mind of man, and is more complex than the small sample one can study.”

- Kenneth L. Pike

The SAMPLE Function and Syntax

The syntax for the SAMPLE function:

 

SAMPLE [ WITH REPLACEMENT ]
[ RANDOMIZED ALLOCATION ]
              [ WHEN <condition>  THEN ]
              {<number-of-rows> | <percentage>}
[...,<number-of-rows> | <percentage>]
              [ ELSE {<number-of-rows> |
<percentage }   END ]

 

 

 

The Sampling function (SAMPLE) permits a SELECT to randomly return rows from a Teradata database table. It allows the request to specify either an absolute number of rows or a percentage of rows to return. Additionally, it provides an ability to return rows from multiple samples.

SAMPLE Function Examples

 

 

 

The above example ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required