LIST SCHEMAS

Syntax

[ LIST | SHOW ] SCHEMAS
[ IN DATABASE database_name ];

Description

This provides a list of schemas in the current database or in a specific database. Only schemas with ownership are returned in the list.

Schemas are listed only if the current role has USAGE privileges on the database and schema.

Arguments

IN DATABASE database_name

Optionally, this lists the schemas in the provided database.

Examples

List schemas in the current database

The following provides a list of schemas in the current demodb database:

demodb.public/demostore# LIST SCHEMAS;
+-----------+-------------+----------+-------------------------------+
|  Name     |  Is Default |  Owner   |  Created At                   |
+===========+=============+==========+===============================+
| public    | false       | sysadmin | 2023-08-09 21:28:40 +0000 UTC |
+-----------+-------------+----------+-------------------------------+
| Analytics | true        | orgadmin | 2024-07-18 16:36:16 +0000 UTC |
+-----------+-------------+----------+-------------------------------+

List schemas in a specific database

The following provides a list of schemas in the user_db database:

main_db.public/demostore# LIST SCHEMAS IN DATABASE user_db;
+--------+-------------+----------+-------------------------------+
|  Name  |  Is Default |  Owner   |  Created At                   |
+========+=============+==========+===============================+
| public | true        | orgadmin | 2024-06-05 19:41:23 +0000 UTC |
+--------+-------------+----------+-------------------------------+

Last updated