Docs / The SQL editor

The SQL editor

MamaSQL's editor is built on CodeMirror and tuned for SQL. It understands your schema, runs in a keystroke, and stays out of your way.

Writing SQL

As you type, MamaSQL suggests tables, columns and keywords drawn from the connected database. Suggestions are ranked by relevance to the statement you're writing, so the column you want is usually first.

  • Schema-aware autocomplete — tables, columns and keywords from the connected database, as you type or with Space
  • Multiple cursorsAlt-click to add cursors
  • Many tabs — keep several queries open at once and switch with Alt 1–9

Running queries

Press to run — if you've selected some SQL, only the selection runs. Each tab has its own connection and schema picker, so you can compare two databases side by side. Rows stream into the panel below as they arrive.

Running long? A Stop button appears while a query executes so you can cancel it.

Formatting

Hit F to reformat your SQL — consistent keyword case, indentation and line breaks.

Exporting results

Any result grid can be exported or copied without leaving the editor:

  • CSV — for spreadsheets and quick sharing
  • JSON — for scripts and APIs
  • Markdown & SQL INSERTs — for docs and seeding data
  • Copy — grab a cell or row straight to the clipboard

See every shortcut on the Keyboard shortcuts page.