SQLLens.AI Docs
Pillar

Query builder

Schema-driven assembly in the SQL editor: drag tables and columns from the live connection tree, type shortcuts before you drop, and let foreign‑key metadata drive JOIN predicates. Generated SQL stays plain text—you keep full control.

Overview

SQLLens.AI’s Query Builder is not a separate diagram canvas. It sits in the editor next to your code: the explorer tree is the source of truth for object names and relationships, drops insert or extend real MySQL statements, and you refine with normal editing.

When it shines: you need correctly spelled identifiers, repeatable scaffolds, or multi‑table JOINs anchored to FK metadata—as opposed to exploratory natural‑language authoring (that's a better fit for SQL with AI).

Premium / entitlement

Some teams gate high‑drag features behind sqllens.ai Cloud entitlement flag qb (see Cloud & account if your org uses sqllens).

Demo (GIF)

Short screen recording bundled with these docs: intro plus Query Builder in VS Code — open a .sql file, optionally type s for a SELECT scaffold, drag a table from the sidebar tree into the editor, then continue with JOINs and clauses as shown.

Query Builder demo

Animated demo: Query Builder — open SQL file, optional s shortcut, drag table from tree into editor.
Screen recording of the flow above. The still diagram below highlights JOIN and subquery moments.
Animated demo: Query Builder highlights and FK-aware joins.
FK-aware joins and builder highlights (query-builder-highlight-demo.gif on sqllens.ai CDN).
Diagram: explorer tree beside editor with JOIN and subquery callouts.
Static diagram of JOIN highlight and inner-SELECT scope — complements the GIF above.
Autocomplete

Typing @com, @dba, schema columns, JOIN ON lines, and favorites uses the same editor — see the dedicated SQL autocomplete guide (screenshots, @ channels, keyboard shortcuts, and troubleshooting).

Drag tables & columns

Open a .sql tab bound to the same connection/database as your tree (same rules as workspace Active state). Drag a table for statement scaffolds, or drag columns into the clause under the caret. Views behave like tables.

Shortcut tokens typed immediately before releasing the drag are expanded together with that drop—the vocabulary follows below.

Smart SQL on drop

Drops infer intent from caret position:

JOINs & dialogs

Bringing an additional fact table evaluates the FK graph. Multiple eligible paths surface prompts so you pick an explicit topology (bridge tables vs shortcuts). Completion lists may reinforce join synonyms such as LJ, IJ, or spelled‑out verbs—pair them with the drag gesture you already use.

Shortcuts before a drop

The demo above (GIF and diagram) summarizes the core gestures. This section collects the shortcut vocabulary: classic tokens before a drag, JOIN synonyms, WHERE / aggregate helpers, and clause-letter shortcuts for SELECT / UPDATE / DELETE stubs.

SQLLens.AI recognizes a wide set of tokens (core DML, JOIN types, WHERE / aggregates, DDL-style fragments, metadata and maintenance helpers). Use autocomplete in the editor to discover spellings that match your muscle memory.

What the GIF and diagram cover

Narration aligned with Demo (GIF) plus the schematic:

What’s new in the editor

The GIF reflects current shipping Query Builder UX in VS Code; extension updates may add gestures before these docs refresh.

Gesture

Type the shortcut at the end of the current line in the SQL editor, then drag a table or column from the connection tree. Drops are clause-aware: caret in WHERE vs SELECT vs JOIN … ON changes the fragment.

Single-letter overload

Common mappings: s → SELECT-style flow; d → DELETE (not “descending”—use od for ORDER BY … DESC); c → CREATE TABLE patterns; desc / dsc → DESCRIBE.

Shortcut families:

Clause-letter shortcuts (S / U / D + W G O H)

On a new stub — start of line (after optional spaces) or right after a semicolon — type a token, then drag a table or column:

Typing only S, U, or D (no W/G/O/H) still uses the classic single-letter shortcuts; the multi-letter form requires at least one of W, G, O, or H after the root letter.

Drag and drop into SQL

employees sample database

Historical salary rows, department bridges, and wide dimensions make MySQL's official employees corpus ideal for JOIN webinars.

Upstream: github.com/datacharmer/test_db.

Loading the sample

Follow the test_db README to import employees into your local server (requires the mysql client and appropriate credentials).

Scenario SQL targets (employees)

Example patterns people often rebuild with the builder on employees:

Settings that shape drags

See Settings → Editor, drag‑drop & JOIN completions (skyline-mysql.*):

Connection mismatch prompts

Dragging from a schema misaligned with the active workspace binding prompts you to remap the tab—or cancel—so queries never silently target the wrong connection/database.

Tips