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 will only be listed 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