# SQL Schemas

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [cloud-data-platform-full.txt](https://docs.redpanda.com/cloud-data-platform-full.txt)

---
title: SQL Schemas
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
latest-redpanda-tag: v26.1.9
docname: sql/schema
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: sql/schema.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/schema.adoc
description: SQL schemas are namespaces in Redpanda SQL. Use them to organize user-defined types and to navigate the PostgreSQL-compatible system catalogs.
page-topic-type: reference
page-git-created-date: "2026-05-26"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/cloud-data-platform/reference/sql/schema.md -->

> 📝 **NOTE**
>
> On this page, "schema" means a SQL namespace in the PostgreSQL sense. It is not the same as a topic’s serialization schema (Protobuf, Avro, or JSON) registered in [Schema Registry](https://docs.redpanda.com/cloud-data-platform/manage/schema-reg/schema-reg-overview/). To map a topic with a Schema Registry schema to a SQL table, see [CREATE TABLE](https://docs.redpanda.com/cloud-data-platform/reference/sql/sql-statements/create-table/).

A SQL schema is a namespace that groups database objects so their names do not collide. Redpanda SQL supports schemas for PostgreSQL compatibility and uses them primarily for organizing user-defined types (UDTs) and exposing the PostgreSQL system catalogs.

User tables in Redpanda SQL are scoped to [catalogs](https://docs.redpanda.com/cloud-data-platform/reference/sql/sql-statements/create-redpanda-catalog/), not directly to SQL schemas. To define a table over a Redpanda topic, use the catalog-qualified `CREATE TABLE` form documented in the [CREATE TABLE](https://docs.redpanda.com/cloud-data-platform/reference/sql/sql-statements/create-table/) reference.

## [](#built-in-schemas)Built-in schemas

Redpanda SQL provides these built-in SQL schemas:

-   `public`: The default schema for user-defined types and other user-created objects that are not catalog-scoped.

-   `pg_catalog`: The [PostgreSQL system catalogs](https://docs.redpanda.com/cloud-data-platform/reference/sql/system-catalogs/) (`pg_class`, `pg_attribute`, `pg_type`, and so on). Available without qualification through the implicit search path.

-   `information_schema`: The [ANSI INFORMATION\_SCHEMA](https://docs.redpanda.com/cloud-data-platform/reference/sql/information-schema/) views over the system catalogs.


## [](#create-a-schema)Create a schema

```sql
CREATE SCHEMA [IF NOT EXISTS] schema_name;
```

-   `schema_name`: Name of the schema to create.

-   `IF NOT EXISTS`: Optional. Prevents an error if the schema already exists.


For example:

```sql
CREATE SCHEMA app_types;
```

## [](#drop-a-schema)Drop a schema

To drop an empty schema:

```sql
DROP SCHEMA [IF EXISTS] schema_name;
```

-   `schema_name`: Name of the schema to drop.

-   `IF EXISTS`: Optional. Prevents an error if the schema does not exist.


To drop a schema and all the objects it contains, use `CASCADE`:

```sql
DROP SCHEMA schema_name CASCADE;
```

## [](#use-if-not-exists)Use IF NOT EXISTS

The `IF NOT EXISTS` option lets `CREATE SCHEMA` succeed without error when the schema already exists. The existing schema is not modified.

Without `IF NOT EXISTS`, repeating `CREATE SCHEMA analytics` fails:

```sql
ERROR:  Schema: analytics already exists
```

With `IF NOT EXISTS`, the same statement succeeds:

```sql
CREATE SCHEMA IF NOT EXISTS analytics;
```

## [](#use-if-exists)Use IF EXISTS

The `IF EXISTS` option lets `DROP SCHEMA` succeed without error when the schema does not exist.

Without `IF EXISTS`, dropping a non-existent schema fails:

```sql
ERROR:  schema "analytics" does not exist
```

With `IF EXISTS`, the same statement succeeds:

```sql
DROP SCHEMA IF EXISTS analytics;
```