CREATE TABLE / DROP TABLE — the table lifecycle

View .md

Control-plane statements — DynamoDB's own PartiQL has no DDL, so these are a DynoStudio dialect surface that lowers to the native AWS calls (CreateTable, DeleteTable), with the plan disclosed in the "Executes as" strip before anything runs. A read-only stage refuses all mutating control-plane work.

Syntax

sql
CREATE TABLE "table" (  PARTITION KEY name STRING | NUMBER | BINARY,   -- or S | N | B  [SORT KEY name type]) WITH BILLING = ON_DEMAND | PROVISIONED (RCU n, WCU n)DROP TABLE "table"        -- DELETE TABLE is an accepted spelling

Each key attribute's type is required: DynamoDB fixes key types at creation and can't change them later, so the studio refuses a key with no explicit type rather than guess one. Guide: Tables, indexes & replicas.

Use cases

Create a table, billed on demand Lowered

The default for new workloads — no capacity planning; the table is CREATING until DynamoDB brings it ACTIVE, and the status line says so.

sql
CREATE TABLE "stage.Ledger" (  PARTITION KEY pk STRING,  SORT KEY sk STRING) WITH BILLING = ON_DEMAND
Executes asCreateTable · keys pk (S) / sk (S) · BillingMode: PAY_PER_REQUEST
Create a table with provisioned capacity Lowered

Steady, predictable traffic can beat on-demand pricing — name the read and write units explicitly.

sql
CREATE TABLE "stage.Metrics" (  PARTITION KEY metricId STRING,  SORT KEY at NUMBER) WITH BILLING = PROVISIONED (RCU 50, WCU 25)
Executes asCreateTable · keys metricId (S) / at (N) · ProvisionedThroughput: 50 RCU / 25 WCU
  • A numeric sort key (at NUMBER) orders numerically — the right shape for epoch timestamps.
Drop a table — deliberately hard Scan — read the note

Irreversible, so the run opens a confirmation that stays disarmed until you type the exact table name — the same stance the AWS Console takes.

sql
DROP TABLE "stage.Ledger"
Executes asDeleteTable · confirmation gate: type the table name to arm
  • A set-based DELETE FROM … WHERE is a bulk data write from DELETE — the two never collide.

Try it

Try it · CREATE TABLESample
Executes asCreateTable · stage.Ledger
CreateTable AttributeDefinitions: pk (S), sk (S) · KeySchema: HASH pk, RANGE sk · BillingMode: PAY_PER_REQUEST
The exact control-plane call, disclosed before consent — a read-only stage refuses it.
Table stage.Ledger · CREATING → ACTIVE

Related: Tables, indexes & replicas · CREATE GSI · Marker indexes · DELETE for removing data.

Was this page helpful?