Schema
Schema DDL commands are used to create, modify, switch, and drop Schema namespaces within a workspace.
Contents
Common Operations
Create a Schema
-- Create a Schema
CREATE SCHEMA IF NOT EXISTS dwd;
-- Create with a comment
CREATE SCHEMA IF NOT EXISTS ads COMMENT = 'Application-facing aggregation layer';
View and Switch
-- List all Schemas
SHOW SCHEMAS;
-- View Schema details
DESC SCHEMA dwd;
-- Switch the default Schema for the current session
USE SCHEMA dwd;
Modify and Drop
-- Rename a Schema
ALTER SCHEMA old_name RENAME TO new_name;
-- Drop a Schema (must be empty or use CASCADE)
DROP SCHEMA IF EXISTS temp_schema;