Query Interface

Writing Queries

Writing Queries

Scratchpad uses a SQL code editor for custom database queries. It supports SQL syntax highlighting, statement execution from the editor, query history, and result rendering below the cell.

Scratchpad Code Editor

Basic Query Flow

sql

SELECT *
FROM users
LIMIT 10;

Running Part Of A Query

If you select SQL text in the editor and press Cmd/Ctrl + Enter, WhoDB runs the selected SQL. If nothing is selected, it runs the editor content.

This is useful for keeping related statements in one cell while testing only one statement at a time.

SELECT Queries

SELECT queries return an interactive grid.

Select Query Result

sql

SELECT id, username, email
FROM users
ORDER BY id
LIMIT 25;

Aggregate Queries

Aggregate queries work like any other SQL your database accepts.

Count Query Result

sql

SELECT COUNT(*) AS total_users
FROM users;

Joins

Use normal SQL joins for your database engine.

Join Query Result

sql

SELECT u.id, u.username, p.amount
FROM users u
JOIN payments p ON p.user_id = u.id
ORDER BY p.amount DESC
LIMIT 25;

Action Queries

Action queries such as INSERT, UPDATE, and DELETE are supported when your database credentials allow them.

sql

UPDATE users
SET status = 'inactive'
WHERE id = 42;

WhoDB detects destructive SQL and asks for confirmation before execution.

Scratchpad Action Result

Errors

Syntax errors and database runtime errors are displayed below the editor.

Query Error

Use a smaller query to isolate the failure:

sql

SELECT 1;

Then add tables, joins, filters, and ordering back one step at a time.

Current Shortcuts

Shortcut
Action
Cmd/Ctrl + Enter
Run current query or selected SQL
Cmd/Ctrl + U
Clear current editor
Query Results

Understand result grids, action outputs, and export entry points.

Query History

Reuse queries saved in cell history.