8.7. CREATE SCHEMA

Synopsis

  1. CREATE SCHEMA [ IF NOT EXISTS ] schema_name
  2. [ WITH ( property_name = expression [, ...] ) ]

Description

Create a new, empty schema. A schema is a container thatholds tables, views and other database objects.

The optional IF NOT EXISTS clause causes the error to besuppressed if the schema already exists.

The optional WITH clause can be used to set propertieson the newly created schema. To list all available schemaproperties, run the following query:

  1. SELECT * FROM system.metadata.schema_properties

Examples

Create a new schema web in the current catalog:

  1. CREATE SCHEMA web

Create a new schema sales in the hive catalog:

  1. CREATE SCHEMA hive.sales

Create the schema traffic if it does not already exist:

  1. CREATE SCHEMA IF NOT EXISTS traffic

See Also

ALTER SCHEMA, DROP SCHEMA