SQL Create Table
The Create Table activity is VisuaLeaf's guided DDL wizard for building brand-new tables against any supported SQL connection (PostgreSQL, MariaDB/MySQL, SQL Server, Oracle, or SQLite). It offers a form-based designer and a raw script editor that stay in sync via a live CREATE TABLE preview, so you can define columns, foreign keys, indexes, and table options without leaving the workspace.
CREATE TABLE.The toolbar exposes a two-way toggle between authoring modes:
CREATE TABLE preview.The bottom bar always shows a single Create Table button; it executes whichever mode is currently active.
Columns are the heart of the wizard. When you open the activity, VisuaLeaf inserts a sensible default id primary key for the dialect (SERIAL on Postgres, INT AUTO_INCREMENT on MariaDB, INTEGER on SQLite, IDENTITY on Oracle, INT identity on SQL Server).
| Field | Purpose |
|---|---|
| Column | The identifier. Highlighted in red if it fails the COLUMN_NAME regex or is a duplicate. |
| Type | Dialect-aware dropdown (INT, VARCHAR, NUMERIC, JSONB, etc.) plus optional size(1) and size(2) inputs (precision/scale). |
| Default | Free-form literal or expression. A placeholder suggests a sensible default for the chosen type (e.g. 0 for INT, CURRENT_TIMESTAMP for TIMESTAMP). |
| PK | Toggle primary-key membership. Multiple columns can be flagged for a composite key. |
| Nullable | Green dot = NULL allowed, red ban = NOT NULL. |
| More | Expands an inline detail row for auto-increment / sequence / identity settings and a column comment. |
| Reorder / Delete | Arrow buttons move a row up or down; the trash icon removes it. |
The expandable row surfaces the identity strategy that matches your dialect:
Seed and Step inputs (Step is hidden for MariaDB).None, SERIAL (auto), or Use existing sequence (paired with a dropdown of sequences in the current database).None or GENERATED AS IDENTITY.unsigned chip.Add composite foreign keys with per-pair source and target column selectors:
NO ACTION, CASCADE, SET NULL, SET DEFAULT, RESTRICT).Primary key indexes are created automatically. Use this tab to add secondary indexes:
idx_users_email).InnoDB, MyISAM, Memory, Archive, etc.COMMENT ON TABLE statement, depending on dialect.Every keystroke re-renders the full CREATE TABLE statement in a read-only monospace block. Example (PostgreSQL):
CREATE TABLE IF NOT EXISTS users (
id SERIAL PRIMARY KEY,
email VARCHAR(255) NOT NULL,
name VARCHAR(120),
is_admin BOOLEAN NOT NULL DEFAULT false,
tenant_id INTEGER NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_users_tenant FOREIGN KEY (tenant_id)
REFERENCES tenants (id) ON DELETE CASCADE
);
CREATE UNIQUE INDEX idx_users_email ON users (email);
COMMENT ON TABLE users IS 'Application users';
Click Create Table in the bottom bar. The button is disabled until the table name is set (form mode) or the script is non-empty (script mode). If execution fails, the error is inlined next to the button; fix the issue and re-run.
Switching between activities preserves the entire editor state — table name, columns, foreign keys, indexes, options, and the active tab — so you can jump to the SQL Editor to prototype a fragment and come back without losing work.
Download and start managing your MongoDB databases with ease.
Download Free Trial