How to Create a Table in Redshift
Last updated July 25, 2026 · By the SaturnSQL team
Use CREATE TABLE with optional DISTKEY and SORTKEY to control how rows are distributed and ordered across nodes. If you omit them, Redshift picks automatic distribution and sort keys, which is a reasonable default for most tables.
CREATE TABLE orders (
id BIGINT IDENTITY(1,1),
customer_id BIGINT NOT NULL,
amount NUMERIC(12,2),
created_at TIMESTAMP DEFAULT GETDATE()
)
DISTKEY (customer_id)
SORTKEY (created_at);Create from a query (CTAS)
CREATE TABLE AS copies data and column types but not IDENTITY, defaults, or constraints. You can set keys explicitly in the CTAS.
CREATE TABLE orders_2026
DISTKEY (customer_id)
SORTKEY (created_at)
AS
SELECT * FROM orders WHERE created_at >= '2026-01-01';Pick the DISTKEY from your most common join column and the SORTKEY from your most common filter column (usually a timestamp). Redshift does not enforce primary or foreign keys; they are metadata hints for the planner.
Run this in SaturnSQL
SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.
Try it free