The SORTED.SAMPLE selection clause keyword causes only a limited number of records to be selected or displayed. The synonym SORTED.FIRST can be used in place of SORTED.SAMPLE.
The SORTED.SAMPLE keyword causes selection or listing of records to terminate after the given number of records have been found.
The record count restriction is applied after sorting. Thus it can be used to show, for example, only the first three records in sorted order of the whole file.
The keyword is ignored if the query does not include a sort clause.
LIST STOCK BY PRICE SORTED.SAMPLE 5
This command lists the first 5 lowest priced items found on the STOCK file.