2018-11-30 13:04:14 +00:00
2017-12-28 15:13:23 +00:00
# Join
2017-04-03 19:49:50 +00:00
2017-04-26 17:26:17 +00:00
A prepared data structure for JOIN that is always located in RAM.
2017-06-13 20:35:07 +00:00
2018-10-16 10:47:17 +00:00
```
2017-12-28 15:13:23 +00:00
Join(ANY|ALL, LEFT|INNER, k1[, k2, ...])
```
2017-06-13 04:15:47 +00:00
2019-04-08 16:07:11 +00:00
Engine parameters: `ANY|ALL` – strictness; `LEFT|INNER` – type. For more information, see the [JOIN Clause ](../../query_language/select.md#select-join ) section.
2017-12-28 15:13:23 +00:00
These parameters are set without quotes and must match the JOIN that the table will be used for. k1, k2, ... are the key columns from the USING clause that the join will be made on.
2017-04-03 19:49:50 +00:00
2017-04-26 17:26:17 +00:00
The table can't be used for GLOBAL JOINs.
2017-04-03 19:49:50 +00:00
2019-05-27 19:34:04 +00:00
You can use INSERT to add data to the table, similar to the Set engine. For ANY, data for duplicated keys will be ignored. For ALL, it will be counted.
2019-05-27 21:21:23 +00:00
You can't perform SELECT directly from the table. There are two ways to retrieve data from table with Join engine
2019-05-27 19:34:04 +00:00
* use it as the "right-hand" table for JOIN
2019-05-27 21:21:23 +00:00
* use `joinGet` function, which allows to extract data from Join table with dictionary-like syntax.
2017-04-03 19:49:50 +00:00
2017-04-26 17:26:17 +00:00
Storing data on the disk is the same as for the Set engine.
2017-12-28 15:13:23 +00:00
2019-05-27 19:34:04 +00:00
You can customize several settings when creating JOIN table with the following syntax:
```
CREATE TABLE join_any_left_null ( ... ) ENGINE = Join(ANY, LEFT, ...) SETTINGS join_use_nulls = 1;
```
The following setting are supported by JOIN engine:
* `join_use_nulls`
* `max_rows_in_join`
* `max_bytes_in_join`
* `join_overflow_mode`
* `join_any_take_last_row`
2018-10-16 10:47:17 +00:00
[Original article ](https://clickhouse.yandex/docs/en/operations/table_engines/join/ ) <!--hide-->