Schema

Schema DDL commands are used to create, modify, switch, and drop Schema namespaces within a workspace.


Contents

PageDescription
CREATE SCHEMACreate a new Schema in the current workspace
ALTER SCHEMAModify Schema properties or rename a Schema
DROP SCHEMADrop a Schema and all objects it contains
USE SCHEMASwitch the default Schema for the current session
DESC SCHEMAView Schema properties and details
SHOW SCHEMASList all Schemas in the current workspace

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;


DocumentDescription
SQL Command OverviewCategorized navigation for all SQL commands
External Catalog & SchemaExternal Schema in federated queries
Schema (Object Model)Schema concepts, namespaces, and permission management