Materialize Logo

CREATE SCHEMA

CREATE SCHEMA creates a new schema.

Conceptual framework

Materialize mimics SQL standard’s namespace hierarchy, which is:

Each layer in the hierarchy can contain elements directly beneath it. In this instance, schemas can contain tables, views, and sources.

For more information, see Namespaces.

Syntax

CREATE SCHEMA IF NOT EXISTS schema_name
Field Use
IF NOT EXISTS If specified, do not generate an error if a schema of the same name already exists.

If not specified, throw an error if a schema of the same name already exists. (Default)
schema_name A name for the schema.

You can specify the database for the schema with a preceding database_name.schema_name, e.g. my_db.my_shcmea, otherwise the schema is created in the current database.

Examples

CREATE SCHEMA my_db.my_schema;
SHOW SCHEMAS FROM my_db;
public
my_schema