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 JOINis equivalent to a query that specifies its join predicate in aWHEREclause. - 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
TABLESAMPLEoption is valid only with user-defined tables and Data Collector (DC) tables. Views and system tables are not supported. ONjoin-predicate- Specifies the columns to join on.
Invalid for
NATURALandCROSSjoins, 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
WHEREclause -
Table joins specified by a
USINGclause
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)