Identifies the sample to which a row belongs, distinguishing rows belonging to different samples specified in the SAMPLE clause of a SELECT statement.
where:
Syntax element … |
Specifies … |
SAMPLEID |
a select list or ORDER BY clause expression that indicates that sample identifiers are to be used to link result set rows with their originating samples. |
SAMPLEID is a Teradata extension to the ANSI SQL:2011 standard.
The sample ID identifies the sample to which a row belongs in the left-to-right order of the SAMPLE clause specification, from 1 through n (where n is the number of samples requested in the SAMPLE clause).
The rules and restrictions are:
The SAMPLEID value for stratified sampling is simply 1, 2, 3, … n across n specified samples regardless of stratification. That is, for the following SAMPLE clause,
|
SAMPLE WHEN state = 'CA' THEN
|
0.3,
|
0.2
|
ELSE
|
0.5,
|
0.2
|
the SAMPLEID correspondence would be: |
1 |
2 |
|
3 |
4 |