- Documentation
- Installation
- Data Import
- Client APIs
- SQL
- Introduction
- Statements
- Overview
- Select
- Insert
- Delete
- Update
- Create Schema
- Create Table
- Create View
- Create Sequence
- Create Macro
- Drop
- Alter Table
- Copy
- Export
- Data Types
- Expressions
- Functions
- Overview
- Numeric Functions
- Text Functions
- Pattern Matching
- Date Functions
- Timestamp Functions
- Time Functions
- Interval Functions
- Date Formats
- Date Parts
- Blob Functions
- Nested Functions
- Indexes
- Aggregates
- Window Functions
- Samples
- Pragmas
- Full Text Search
- Development
- Sitemap
- Why DuckDB
- FAQ
- Code of Conduct
- Live Demo
Create Schema
Version 0.2.9
The CREATE SCHEMA
statement creates a schema in the catalog. The default schema is main
.
Examples
-- create a schema
CREATE SCHEMA s1;
-- create a schema if it does not exist yet
CREATE SCHEMA IF NOT EXISTS s2;
-- create table in the schemas
CREATE TABLE s1.t(id INTEGER PRIMARY KEY, other_id INTEGER);
CREATE TABLE s2.t(id INTEGER PRIMARY KEY, j VARCHAR);
-- compute a join between tables from two schemas
SELECT * FROM s1.t s1t, s2.t s2t WHERE s1t.other_id = s2t.id;
Syntax
Search Shortcut cmd + k | ctrl + k