Joined-table
Specifies how to join tables.
Specifies how to join tables.
Syntax
table-reference [ join-type ] JOIN table-reference [ TABLESAMPLE(percent) ] [ ON join-predicate ]
Arguments
table-reference
- A table name, optionally qualified.
join-type
- One of the following:
-
INNER (default).
INNER JOIN
is equivalent to a query that specifies its join predicate in aWHERE
clause. - LEFT [ OUTER ]
- RIGHT [ OUTER ]
- FULL [ OUTER ]
- NATURAL
- CROSS
-
TABLESAMPLE(
percent
)
- Use simple random sampling to return an approximate percentage of records. The percentage value must be greater than 0 and less than 100. All rows in the total potential return set are equally eligible to be included in the sampling. Vertica performs this sampling before other filters in the query are applied. The number of records returned is not guaranteed to be exactly
percent
.The
TABLESAMPLE
option is valid only with user-defined tables and Data Collector (DC) tables. Views and system tables are not supported. ON
join-predicate
- Specifies the columns to join on.
Invalid for
NATURAL
andCROSS
joins, required for all other join types.
Alternative JOIN syntax options
Vertica supports two older join syntax conventions:
-
Table joins specified by join predicate in a
WHERE
clause -
Table joins specified by a
USING
clause
For details, see Join Syntax.
Examples
The following SELECT
statement qualifies its JOIN
clause with the TABLESAMPLE
option:
=> SELECT user_id.id, user_name.name FROM user_name TABLESAMPLE(50)
JOIN user_id TABLESAMPLE(50) ON user_name.id = user_id.id;
id | name
------+--------
489 | Markus
2234 | Cato
763 | Pompey
(3 rows)