FROM Clause

A comma-separated list of data sources to query.

Syntax

FROM dataset [,... ] [ TABLESAMPLE(sampling_percent) ]

Parameters

dataset

A set of data to query, which can be one of the following elements:

TABLESAMPLE

A clause after dataset indicating that simple random sampling should be used to return an approximate percentage of records. Each row of the data set has the same opportunity to be selected. Vertica performs this sampling before other filters in the query are applied. The number of records returned is not guaranteed to be the exact percentage of records defined by sampling_percent.

You can only use the TABLESAMPLE clause with user-defined tables. Views, Data Collector (DC), and system tables are not supported.

sampling_percent
Specifies the percentage of records to be returned as a part of the sampling. The value must be greater than 0 and less than 100.

Examples

The following example shows how you can return all records from the customer_dimension table:

=> SELECT * FROM customer_dimension;

The following example shows how you can use the TABLESAMPLE clause:

=> SELECT * FROM user_name TABLESAMPLE(50);
  id  | name
------+-------
  111 | Barry
  982 | Nero
 8761 | Lou
(3 rows)