Operations with schemes
-
CREATE SCHEMA— Create a new schema -
ALTER SCHEMA— Change schema attributes -
DROP SCHEMA— Deleting a schema
Create a new schema
CREATE [OR REPLACE] SCHEMA [IF NOT EXISTS] <schema_name>
Creates a new schema with the specified name.
If the OR REPLACE modifier is specified, the final action is equivalent to deleting the existing schema with all objects in it and creating a new schema with the same name.
The optional IF NOT EXISTS modifier restricts the query to only those cases in which the specified object does not already exist.
| The modifiers are mutually exclusive. Specifying them both will result in an error. |
Change schema attributes
ALTER SCHEMA [IF EXISTS] <schema_name> RENAME TO <new_name>;
Modifies the pattern with the specified action.
Currently, only one action is available for changing schemes:
-
The
RENAME TOaction renames the schema to the specified name<new_name>. All attributes and permissions are retained.
The optional IF EXISTS modifier restricts the query to only those cases in which the specified object exists.