# schemas

## Description

Exposes metadata about schemas (namespaces) in the organization. Only schemas on which the current role has USAGE privileges are returned.

## Syntax

```sql
SELECT ... FROM deltastream.sys."schemas";
```

## Columns

| Column                    | Type           | Nullable | Description                                                         |
| ------------------------- | -------------- | -------- | ------------------------------------------------------------------- |
| `name`                    | VARCHAR        | No       | Name of the schema.                                                 |
| `database_name`           | VARCHAR        | No       | Name of the database this schema belongs to.                        |
| `is_default`              | BOOLEAN        | No       | Whether this is the default schema for the database.                |
| `owner`                   | VARCHAR        | No       | The role that owns this resource.                                   |
| `created_by_role`         | VARCHAR        | No       | The role that created this resource.                                |
| `created_by_role_deleted` | BOOLEAN        | No       | Whether the creating role has since been deleted.                   |
| `created_by`              | VARCHAR        | No       | The user that created this resource.                                |
| `created_at`              | TIMESTAMP\_LTZ | No       | Timestamp when this resource was created.                           |
| `updated_by_role`         | VARCHAR        | No       | The role that last updated this resource.                           |
| `updated_by_role_deleted` | BOOLEAN        | No       | Whether the last updating role has since been deleted.              |
| `updated_by`              | VARCHAR        | No       | The user that last updated this resource.                           |
| `updated_at`              | TIMESTAMP\_LTZ | No       | Timestamp when this resource was last updated.                      |
| `organization_id`         | VARCHAR        | No       | The unique identifier of the organization this resource belongs to. |

## Examples

```sql
SELECT * FROM deltastream.sys."schemas";
```

```sh
[{"name":"public","database_name":"mydb","owner":"sysadmin","is_default":true,"created_by_role":"orgadmin","created_by_role_deleted":false,"created_by":"user@example.com","created_at":"2025-05-23T20:49:02.361Z","updated_by_role":"orgadmin","updated_by_role_deleted":false,"updated_by":"user@example.com","updated_at":"2025-05-23T20:49:02.361Z","organization_id":"00000000-0000-0000-0000-000000000001"},{"name":"ns1","database_name":"db2","owner":"sysadmin","is_default":false,"created_by_role":"sysadmin","created_by_role_deleted":false,"created_by":"user@example.com","created_at":"2025-11-17T22:01:50.088Z","updated_by_role":"sysadmin","updated_by_role_deleted":false,"updated_by":"user@example.com","updated_at":"2025-11-17T22:01:50.088Z","organization_id":"00000000-0000-0000-0000-000000000001"}]
```

Filter schemas by database:

```sql
SELECT name, is_default FROM deltastream.sys."schemas" WHERE database_name = 'mydb';
```

## See Also

* [System Tables Overview](https://docs.deltastream.io/reference/sql-syntax/systables)
* [LIST SCHEMAS](https://docs.deltastream.io/reference/sql-syntax/command/list-schemas)
* [CREATE SCHEMA](https://docs.deltastream.io/reference/sql-syntax/ddl/create-schema)
