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, SQLite, and libSQL; 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 - with a navigation rail 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.

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.

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.

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, 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. On databases with transactional DDL it runs atomically; on MySQL and MariaDB each statement is applied in order.
  • On SQLite and libSQL, 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.
  • 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, foreign keys, unique and check constraints are Pro sections.