mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-05 05:52:05 +00:00
1.2 KiB
1.2 KiB
slug | sidebar_position | sidebar_label | title |
---|---|---|---|
/en/sql-reference/table-functions/dictionary | 47 | dictionary | dictionary |
Displays the dictionary data as a ClickHouse table. Works the same way as Dictionary engine.
Syntax
dictionary('dict')
Arguments
dict
— A dictionary name. String.
Returned value
A ClickHouse table.
Example
Input table dictionary_source_table
:
┌─id─┬─value─┐
│ 0 │ 0 │
│ 1 │ 1 │
└────┴───────┘
Create a dictionary:
CREATE DICTIONARY new_dictionary(id UInt64, value UInt64 DEFAULT 0) PRIMARY KEY id
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'dictionary_source_table')) LAYOUT(DIRECT());
Query:
SELECT * FROM dictionary('new_dictionary');
Result:
┌─id─┬─value─┐
│ 0 │ 0 │
│ 1 │ 1 │
└────┴───────┘
See Also