2022-06-02 10:55:18 +00:00
|
|
|
# databases
|
2020-06-18 08:24:31 +00:00
|
|
|
|
2020-12-01 21:26:28 +00:00
|
|
|
Contains information about the databases that are available to the current user.
|
2020-06-18 08:24:31 +00:00
|
|
|
|
2020-12-01 19:36:08 +00:00
|
|
|
Columns:
|
2020-06-18 08:24:31 +00:00
|
|
|
|
2020-12-01 19:36:08 +00:00
|
|
|
- `name` ([String](../../sql-reference/data-types/string.md)) — Database name.
|
2020-12-01 22:30:05 +00:00
|
|
|
- `engine` ([String](../../sql-reference/data-types/string.md)) — [Database engine](../../engines/database-engines/index.md).
|
2020-12-01 19:36:08 +00:00
|
|
|
- `data_path` ([String](../../sql-reference/data-types/string.md)) — Data path.
|
|
|
|
- `metadata_path` ([String](../../sql-reference/data-types/enum.md)) — Metadata path.
|
|
|
|
- `uuid` ([UUID](../../sql-reference/data-types/uuid.md)) — Database UUID.
|
2021-10-21 19:41:11 +00:00
|
|
|
- `comment` ([String](../../sql-reference/data-types/enum.md)) — Database comment.
|
2020-08-06 08:50:29 +00:00
|
|
|
|
2020-12-01 19:36:08 +00:00
|
|
|
The `name` column from this system table is used for implementing the `SHOW DATABASES` query.
|
|
|
|
|
|
|
|
**Example**
|
|
|
|
|
|
|
|
Create a database.
|
|
|
|
|
|
|
|
``` sql
|
2021-10-21 19:41:11 +00:00
|
|
|
CREATE DATABASE test;
|
2020-12-01 19:36:08 +00:00
|
|
|
```
|
|
|
|
|
2020-12-01 21:26:28 +00:00
|
|
|
Check all of the available databases to the user.
|
2020-12-01 19:36:08 +00:00
|
|
|
|
|
|
|
``` sql
|
2021-10-21 19:41:11 +00:00
|
|
|
SELECT * FROM system.databases;
|
2020-12-01 19:36:08 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
``` text
|
2021-10-21 19:41:11 +00:00
|
|
|
┌─name───────────────┬─engine─┬─data_path──────────────────┬─metadata_path───────────────────────────────────────────────────────┬─uuid─────────────────────────────────┬─comment─┐
|
|
|
|
│ INFORMATION_SCHEMA │ Memory │ /var/lib/clickhouse/ │ │ 00000000-0000-0000-0000-000000000000 │ │
|
|
|
|
│ default │ Atomic │ /var/lib/clickhouse/store/ │ /var/lib/clickhouse/store/d31/d317b4bd-3595-4386-81ee-c2334694128a/ │ 24363899-31d7-42a0-a436-389931d752a0 │ │
|
|
|
|
│ information_schema │ Memory │ /var/lib/clickhouse/ │ │ 00000000-0000-0000-0000-000000000000 │ │
|
|
|
|
│ system │ Atomic │ /var/lib/clickhouse/store/ │ /var/lib/clickhouse/store/1d1/1d1c869d-e465-4b1b-a51f-be033436ebf9/ │ 03e9f3d1-cc88-4a49-83e9-f3d1cc881a49 │ │
|
|
|
|
└────────────────────┴────────┴────────────────────────────┴─────────────────────────────────────────────────────────────────────┴──────────────────────────────────────┴─────────┘
|
2020-12-01 19:36:08 +00:00
|
|
|
```
|