* DOCSUP-2806: Add meta intro. * DOCSUP-2806: Update meta intro. * DOCSUP-2806: Fix meta. * DOCSUP-2806: Add quotes for meta headers. * DOCSUP-2806: Remove quotes from meta headers. * DOCSUP-2806: Add meta headers. * DOCSUP-2806: Fix quotes in meta headers. * DOCSUP-2806: Update meta headers. * DOCSUP-2806: Fix link to nowhere in EN. * DOCSUP-2806: Fix link (settings to tune) * DOCSUP-2806: Fix links. * DOCSUP-2806:Fix links EN * DOCSUP-2806: Fix build errors. * DOCSUP-2806: Fix meta intro. * DOCSUP-2806: Fix toc_priority in examples datasets TOC. * DOCSUP-2806: Fix items order in toc. * DOCSUP-2806: Fix order in toc. * DOCSUP-2806: Fix toc order. * DOCSUP-2806: Fix order in toc. * DOCSUP-2806: Fix toc index in create * DOCSUP-2806: Fix toc order in create. Co-authored-by: romanzhukov <romanzhukov@yandex-team.ru> Co-authored-by: alexey-milovidov <milovidov@yandex-team.ru>
9.6 KiB
toc_priority | toc_title |
---|---|
37 | SHOW |
SHOW Statements
SHOW CREATE TABLE
SHOW CREATE [TEMPORARY] [TABLE|DICTIONARY] [db.]table [INTO OUTFILE filename] [FORMAT format]
Returns a single String
-type ‘statement’ column, which contains a single value – the CREATE
query used for creating the specified object.
SHOW DATABASES
Prints a list of all databases.
SHOW DATABASES [LIKE | ILIKE | NOT LIKE '<pattern>'] [LIMIT <N>] [INTO OUTFILE filename] [FORMAT format]
This statement is identical to the query:
SELECT name FROM system.databases [WHERE name LIKE | ILIKE | NOT LIKE '<pattern>'] [LIMIT <N>] [INTO OUTFILE filename] [FORMAT format]
Examples
Getting database names, containing the symbols sequence 'de' in their names:
SHOW DATABASES LIKE '%de%'
Result:
┌─name────┐
│ default │
└─────────┘
Getting database names, containing symbols sequence 'de' in their names, in the case insensitive manner:
SHOW DATABASES ILIKE '%DE%'
Result:
┌─name────┐
│ default │
└─────────┘
Getting database names, not containing the symbols sequence 'de' in their names:
SHOW DATABASES NOT LIKE '%de%'
Result:
┌─name───────────────────────────┐
│ _temporary_and_external_tables │
│ system │
│ test │
│ tutorial │
└────────────────────────────────┘
Getting the first two rows from database names:
SHOW DATABASES LIMIT 2
Result:
┌─name───────────────────────────┐
│ _temporary_and_external_tables │
│ default │
└────────────────────────────────┘
See Also
SHOW PROCESSLIST
SHOW PROCESSLIST [INTO OUTFILE filename] [FORMAT format]
Outputs the content of the system.processes table, that contains a list of queries that is being processed at the moment, excepting SHOW PROCESSLIST
queries.
The SELECT * FROM system.processes
query returns data about all the current queries.
Tip (execute in the console):
$ watch -n1 "clickhouse-client --query='SHOW PROCESSLIST'"
SHOW TABLES
Displays a list of tables.
SHOW [TEMPORARY] TABLES [{FROM | IN} <db>] [LIKE | ILIKE | NOT LIKE '<pattern>'] [LIMIT <N>] [INTO OUTFILE <filename>] [FORMAT <format>]
If the FROM
clause is not specified, the query returns the list of tables from the current database.
This statement is identical to the query:
SELECT name FROM system.tables [WHERE name LIKE | ILIKE | NOT LIKE '<pattern>'] [LIMIT <N>] [INTO OUTFILE <filename>] [FORMAT <format>]
Examples
Getting table names, containing the symbols sequence 'user' in their names:
SHOW TABLES FROM system LIKE '%user%'
Result:
┌─name─────────────┐
│ user_directories │
│ users │
└──────────────────┘
Getting table names, containing sequence 'user' in their names, in the case insensitive manner:
SHOW TABLES FROM system ILIKE '%USER%'
Result:
┌─name─────────────┐
│ user_directories │
│ users │
└──────────────────┘
Getting table names, not containing the symbol sequence 's' in their names:
SHOW TABLES FROM system NOT LIKE '%s%'
Result:
┌─name─────────┐
│ metric_log │
│ metric_log_0 │
│ metric_log_1 │
└──────────────┘
Getting the first two rows from table names:
SHOW TABLES FROM system LIMIT 2
Result:
┌─name───────────────────────────┐
│ aggregate_function_combinators │
│ asynchronous_metric_log │
└────────────────────────────────┘
See Also
SHOW DICTIONARIES
Displays a list of external dictionaries.
SHOW DICTIONARIES [FROM <db>] [LIKE '<pattern>'] [LIMIT <N>] [INTO OUTFILE <filename>] [FORMAT <format>]
If the FROM
clause is not specified, the query returns the list of dictionaries from the current database.
You can get the same results as the SHOW DICTIONARIES
query in the following way:
SELECT name FROM system.dictionaries WHERE database = <db> [AND name LIKE <pattern>] [LIMIT <N>] [INTO OUTFILE <filename>] [FORMAT <format>]
Example
The following query selects the first two rows from the list of tables in the system
database, whose names contain reg
.
SHOW DICTIONARIES FROM db LIKE '%reg%' LIMIT 2
┌─name─────────┐
│ regions │
│ region_names │
└──────────────┘
SHOW GRANTS
Shows privileges for a user.
Syntax
SHOW GRANTS [FOR user]
If user is not specified, the query returns privileges for the current user.
SHOW CREATE USER
Shows parameters that were used at a user creation.
SHOW CREATE USER
doesn’t output user passwords.
Syntax
SHOW CREATE USER [name | CURRENT_USER]
SHOW CREATE ROLE
Shows parameters that were used at a role creation.
Syntax
SHOW CREATE ROLE name
SHOW CREATE ROW POLICY
Shows parameters that were used at a row policy creation.
Syntax
SHOW CREATE [ROW] POLICY name ON [database.]table
SHOW CREATE QUOTA
Shows parameters that were used at a quota creation.
Syntax
SHOW CREATE QUOTA [name | CURRENT]
SHOW CREATE SETTINGS PROFILE
Shows parameters that were used at a settings profile creation.
Syntax
SHOW CREATE [SETTINGS] PROFILE name
SHOW USERS
Returns a list of user account names. To view user accounts parameters, see the system table system.users.
Syntax
SHOW USERS
SHOW ROLES
Returns a list of roles. To view another parameters, see system tables system.roles and system.role-grants.
Syntax
SHOW [CURRENT|ENABLED] ROLES
SHOW PROFILES
Returns a list of setting profiles. To view user accounts parameters, see the system table settings_profiles.
Syntax
SHOW [SETTINGS] PROFILES
SHOW POLICIES
Returns a list of row policies for the specified table. To view user accounts parameters, see the system table system.row_policies.
Syntax
SHOW [ROW] POLICIES [ON [db.]table]
SHOW QUOTAS
Returns a list of quotas. To view quotas parameters, see the system table system.quotas.
Syntax
SHOW QUOTAS
SHOW QUOTA
Returns a quota consumption for all users or for current user. To view another parameters, see system tables system.quotas_usage and system.quota_usage.
Syntax
SHOW [CURRENT] QUOTA