CREATE DICTIONARY
Creates a new dictionary with given structure, source, layout and lifetime.
Syntax
The dictionary structure consists of attributes. Dictionary attributes are specified similarly to table columns. The only required attribute property is its type, all other properties may have default values.
ON CLUSTER
clause allows creating dictionary on a cluster, see Distributed DDL.
Depending on dictionary layout one or more attributes can be specified as dictionary keys.
SOURCE
The source for a dictionary can be a:
- table in the current ClickHouse service
- table in a remote ClickHouse service
- file available by HTTP(S)
- another database
Create a dictionary from a table in the current ClickHouse service
Input table source_table
:
Creating the dictionary:
Output the dictionary:
When using the SQL console in ClickHouse Cloud, you must specify a user (default
or any other user with the role default_role
) and password when creating a dictionary.
Create a dictionary from a table in a remote ClickHouse service
Input table (in the remote ClickHouse service) source_table
:
Creating the dictionary:
Create a dictionary from a file available by HTTP(S)
Create a dictionary from another database
Please see the details in Dictionary sources.
See Also
- For more information, see the Dictionaries section.
- system.dictionaries — This table contains information about Dictionaries.