Schema

SQL DDL

SQL Data Definition Language

Adopt Formal standard ANSI / ISO/IEC 9075 Since 1986

Judgement: Adopt

Universal way to describe a relational schema; portable across engines.

The CREATE / ALTER / DROP subset of SQL — the most universal way to describe a relational schema.

The Data Contract CLI imports SQL DDL into ODCS contracts and exports back to it, because every relational engine speaks at least a flavour of it.

Example

Structure and constraints as statements the database enforces, not documentation it ignores.

CREATE TABLE orders (
    id          BIGINT        PRIMARY KEY,
    customer_id BIGINT        NOT NULL REFERENCES customers (id),
    amount      DECIMAL(10,2) NOT NULL CHECK (amount > 0),
    city        VARCHAR(64),
    created_at  TIMESTAMP     DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE orders ADD COLUMN channel VARCHAR(32);

At a glance

Category
Schema
Governance
ANSI / ISO/IEC 9075
Status
Stable; per-vendor extensions are everywhere
First released
1986

Links

Related standards

Other standards in Schema.

See SQL DDL in context

Open the interactive Data Landscape to compare SQL DDL against every other open standard, or grab the raw JSON. Spotted something wrong? Open an issue.