Skip to content

Commit b40aad3

Browse files
committed
system.databases
1 parent caad43b commit b40aad3

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: system.databases
3+
---
4+
5+
Provides metadata about all databases in the system, including their catalogs, names, unique IDs, owners, and drop timestamps.
6+
7+
See also: [SHOW DATABASES](../../10-sql-commands/00-ddl/00-database/show-databases.md)
8+
9+
```sql title='Examples:'
10+
SELECT * FROM system.databases;
11+
12+
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
13+
│ catalog │ name │ database_id │ owner │ dropped_on │
14+
├─────────┼────────────────────┼─────────────────────┼──────────────────┼─────────────────────┤
15+
│ default │ system │ 4611686018427387905NULLNULL
16+
│ default │ information_schema │ 4611686018427387906NULLNULL
17+
│ default │ default │ 1NULLNULL
18+
│ default │ doc │ 2597 │ account_admin │ NULL
19+
└─────────────────────────────────────────────────────────────────────────────────────────────┘
20+
```
21+
22+
To show the schema of `system.databases`, use `DESCRIBE system.databases`:
23+
24+
```sql
25+
DESCRIBE system.databases;
26+
27+
┌───────────────────────────────────────────────────────────┐
28+
│ Field │ Type │ Null │ Default │ Extra │
29+
├─────────────┼─────────────────┼────────┼─────────┼────────┤
30+
│ catalog │ VARCHAR │ NO │ '' │ │
31+
│ name │ VARCHAR │ NO │ '' │ │
32+
│ database_id │ BIGINT UNSIGNED │ NO │ 0 │ │
33+
│ owner │ VARCHAR │ YES │ NULL │ │
34+
│ dropped_on │ TIMESTAMP │ YES │ NULL │ │
35+
└───────────────────────────────────────────────────────────┘
36+
```

docs/en/sql-reference/00-sql-reference/20-system-tables/system-tables-with-history.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ SELECT * FROM system.tables_with_history LIMIT 3;
2121
To show the schema of `system.tables_with_history`, use `DESCRIBE system.tables_with_history`:
2222

2323
```sql
24-
DESCRIBE system.tables_with_history
24+
DESCRIBE system.tables_with_history;
2525

2626
┌─────────────────────────────────────────────────────────────────────────────────────────┐
2727
│ Field │ Type │ Null │ Default │ Extra │

docs/en/sql-reference/10-sql-commands/00-ddl/00-database/show-databases.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import FunctionDescription from '@site/src/components/FunctionDescription';
88

99
Shows the list of databases that exist on the instance.
1010

11+
See also: [system.databases](../../../00-sql-reference/20-system-tables/system-databases.md)
12+
1113
## Syntax
1214

1315
```sql

0 commit comments

Comments
 (0)