SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
2-186
SELECT Statement
SAMPLE sampling-method
specifies the sampling method used to select a subset of the intermediate result
table of a SELECT statement. Each of the methods uses a sampling size. The
three sampling methods—random, first, and periodic—are specified as:
RANDOM percent-size
directs NonStop SQL/MX to choose rows randomly (each row having an
unbiased probability of being chosen) without replacement from the result
table. The sampling size is determined by using a percent of the result table.
FIRST rows-size [SORT BY colname [,colname]...]
directs NonStop SQL/MX to choose the first rows-size rows from the sorted
result table. The sampling size is determined by using the specified number of
rows.
PERIODIC rows-size EVERY number-rows ROWS
[SORT BY colname [,colname]...]
directs NonStop SQL/MX to choose the first rows from each block (period) of
contiguous sorted rows. The sampling size is determined by using the
specified number of rows chosen from each block.
SAMPLE is an SQL/MX extension. See SET CATALOG Statement on page 2-208.
TRANSPOSE transpose-set [transpose-set]...
[KEY BY key-colname]
specifies the transpose-sets and an optional key clause within a TRANSPOSE
clause. You can use multiple TRANSPOSE clauses in a SELECT statement.
transpose-item-list AS transpose-col-list
specifies a transpose-set. You can use multiple transpose sets within a
TRANSPOSE clause. The TRANSPOSE clause generates, for each row of the
source table derived from the table reference or references in the FROM
clause, a row for each item in each transpose-item-list of all the
transpose sets.
The result table of a TRANSPOSE clause has all the columns of the source
table plus a value column or columns, as specified in each
transpose-col-list of all the transpose sets, and an optional key column
key-colname.
KEY BY key-colname
optionally specifies an optional key column key-colname. It identifies which
expression the value in the transpose column list corresponds to by its position
in the transpose-item-list. key-colname is an SQL identifier. The data
type is exact numeric, and the value is NOT NULL.