Skip to content

DB Explorer

Create or Edit Tables

Use the table designer to create tables or change their structure while reviewing the exact SQL before it runs. The designer is available for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite, libSQL, self-hosted ClickHouse 24.8 and newer (standalone and clustered), writable DuckDB databases, and writable DuckLake catalogs stored in a DuckDB file, SQLite, or PostgreSQL. Read-only DuckDB databases, MotherDuck, Iceberg, DuckLake catalogs stored in MySQL or served over quack, ClickHouse Cloud tables, ClickHouse servers older than 24.8, read-only ClickHouse connections, ClickHouse databases on engines other than Atomic, Ordinary, and Replicated (such as Lazy, Memory, or MySQL), ClickHouse tables whose engine the designer does not offer, and file connections change table structure through SQL only. Other databases open the classic table editor with the same commands.

  • Create a table: in Connections, right-click Tables and select Create.
  • Edit a table: right-click the table and select Alter, or use DBCode: Alter Table from the command palette while a table’s data is open.

Create command in the Tables context menu

The designer shows the table as sections - Columns, Primary Key, Indexes, Foreign Keys, Unique Constraints, Check Constraints, and table properties - listed on the left. Edits are staged: every change marks its row with a change bar and shows the previous value beneath the new one, and nothing touches the database until you apply.

On DuckLake, the designer shows the Table and Columns sections. The Table section also sets Partitioned By, how DuckLake splits new data files (by a column’s value, by the year, month, day, or hour of a date or timestamp, or into hash buckets), and Sorted By, the order it writes rows in.

On ClickHouse, the designer shows the Table, Columns, Indexes, Projections, and Check Constraints sections. The Table section sets the engine (MergeTree, ReplacingMergeTree, SummingMergeTree, AggregatingMergeTree, CollapsingMergeTree, VersionedCollapsingMergeTree, CoalescingMergeTree, Log, TinyLog, StripeLog, or Memory) and the columns that engine works with, such as the version or sign column, along with the Order By, Primary Key, Partition By, and Sample By keys, the table TTL, settings, and comment. While you type a key, the designer suggests the table’s columns: pick one to insert it, or type any expression, such as toYYYYMM(created_at). Replicated makes a MergeTree table a Replicated one, with its Keeper path and replica name, and Cluster applies each change on every host of the chosen cluster. Indexes holds the skip indexes, Projections the projections, and Check Constraints the constraints.

Table designer showing staged columns for a new project assignments table and its generated SQL

Each column row covers the fields every engine shares: name, type, length, nullable, default, and comment. Engine-specific attributes - auto increment, unsigned, enum values, identity, sparse, masking, and the like - fold into one Attributes cell: a chip appears for each attribute that is set, and clicking the cell opens an editor offering exactly the attributes the column’s current type supports.

On ClickHouse, each column also sets its Kind (DEFAULT, MATERIALIZED, ALIAS, or EPHEMERAL) with its Expression, and its LowCardinality, Codec, TTL, Statistics, and Settings. Drag a column row, or use Move up and Move down, to change where the column sits in the table.

On DuckDB, Auto Increment numbers each new row from a sequence named after the table and column, such as orders_id_seq.

Column attributes editor for an employee identifier

Key and index columns are chips that drag to reorder - column order matters for composite keys. Add a column with the +, which lists the columns not yet included.

On DuckDB and PostgreSQL, each index has an editable comment, including expression indexes whose definition is read-only.

Primary key column picker showing available employee columns

A foreign key’s + walks the whole reference in one picker: the source column, then the referenced schema (skipped for databases without schemas), table, and column, each list showing data types. The referenced table appears in each pair as a chip - click it to re-target the key. Anything the picker cannot list, such as a cross-database target, can be typed instead.

Foreign key referenced schema picker for the employees table

The SQL Plan panel at the bottom recompiles automatically as you edit, drawing the plan’s success and failure paths as a branching flow and showing every statement in execution order with syntax highlighting, plus Destructive and Lossy badges where a statement removes objects or can change data. Statements that must wrap other objects around a change - for example, SQL Server recreating an index around an ALTER COLUMN - are planned for you.

SQL Plan showing a destructive column removal before changes are applied

  • Apply changes runs the plan, and a running apply can be cancelled. On databases with transactional DDL it runs atomically; on MySQL, MariaDB, and ClickHouse each statement is applied in order.
  • On SQLite, libSQL, and DuckDB, some changes cannot be made with ALTER TABLE and instead apply as a safe whole-table rebuild, with the data copy shown as its own step in the plan.
  • On ClickHouse, a change that ALTER TABLE cannot make, such as a new engine or Partition By, copies the table into a new one and swaps it in, and the plan notes that rows written during the copy are lost. Where a type change could fail on stored values, the designer first checks them and changes nothing if one does not convert.
  • Copy SQL and Open in Editor take the plan as a script instead, if you would rather run it yourself or save it as a migration.

After applying, the same panel shows the result per statement, and the designer re-reads the table so what you see always matches the database. If the table changes underneath an open designer - another session, another tool - the apply is refused rather than run against a stale plan.

  • A row or field the designer cannot faithfully reproduce (an exotic index type, a disabled constraint, an unreadable masked column) is shown read-only rather than silently rewritten.
  • Creating tables and the column, primary key, and table-property edits are free; indexes, projections, foreign keys, unique and check constraints are Pro sections.