* CLICKHOUSEDOCS-559: Started to describe GRANT * CLICKHOUSEDOCS-559: Added headers for some other kinds of quries. * CLICKHOUSEDOCS-559: Further edits. * CLICKHOUSEDOCS-559: Updated grant description. * CLICKHOUSEDOCS-559: The first version for the GRANT statement is finished. * CLICKHOUSEDOCS-559: Almost finished CREATE USER * CLICKHOUSEDOCS-559: Finished the first version of CREATE queries. * CLICKHOUSEDOCS-559: Finished ALTER, DROP and SET. * CLICKHOUSEDOCS-559: Finished the first version of statements. * CLICKHOUSEDOCS-559: Update by review. * CLICKHOUSEDOCS-559: Update by review. * Update docs/en/query_language/alter.md * Update docs/en/query_language/create.md Co-Authored-By: Ilya Yatsishin <2159081+qoega@users.noreply.github.com> * Update docs/en/query_language/grant.md Co-Authored-By: Ilya Yatsishin <2159081+qoega@users.noreply.github.com> * Update by comments. Also RBAC-7 aplied. * moved new files to new structure * Adopted added articles to a new structure. * CLICKHOUSEDOCS-559: Fixed links. * CLICKHOUSEDOCS-559: Links fix. * CLICKHOUSEDOCS-559: Updated privileges by RBAC-8 changes * CLICKHOUSEDOCS-559: Added CREATE, ALTER, DROP, and SHOW queries for QUOTAS and SETTINGS PROFILES. * CLICKHOUSEDOCS-559: Added ON CLUSTER for CREATE, ALTER, DROP. * CLICKHOUSEDOCS-559: Fixed code-blocks and the anchor. * CLICKHOUSEDOCS-559: Edits after the last portion of commentaries. * CLICKHOUSEDOCS-559: Changed example Co-authored-by: Sergei Shtykov <bayonet@yandex-team.ru> Co-authored-by: Ilya Yatsishin <2159081+qoega@users.noreply.github.com>
4.6 KiB
toc_priority | toc_title |
---|---|
38 | SHOW |
SHOW Queries
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
SHOW DATABASES [INTO OUTFILE filename] [FORMAT format]
Prints a list of all databases.
This query is identical to SELECT name FROM system.databases [INTO OUTFILE filename] [FORMAT format]
.
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 '<pattern>' | WHERE expr] [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.
You can get the same results as the SHOW TABLES
query in the following way:
SELECT name FROM system.tables 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 co
.
SHOW TABLES FROM system LIKE '%co%' LIMIT 2
┌─name───────────────────────────┐
│ aggregate_function_combinators │
│ collations │
└────────────────────────────────┘
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