Skip to content

SQL Scratchpad

SQL Scratchpad is a SQL editor that lets you query ERD entity data directly in the browser.

SQL Scratchpad Editor Screen showing SQL editor, results grid, and notebook cells

How to Use

Open the Data Lab panel at the bottom of the ERD canvas, and select the SQL tab.


Executing Queries

Type SQL into the editor and press the Run button or Ctrl+Enter to display results in the grid below.

Supported SQL

Statement Description Example
SELECT Data retrieval SELECT * FROM CUSTOMER
WHERE Condition filtering WHERE CUST_TYPE = 'VIP'
JOIN Table joins JOIN ORD ON CUSTOMER.CUST_NO = ORD.CUST_NO
GROUP BY Group aggregation GROUP BY CUST_TYPE
ORDER BY Sorting ORDER BY REG_DT DESC
INSERT Data insertion INSERT INTO CUSTOMER VALUES (...)
UPDATE Data modification UPDATE CUSTOMER SET ...
DELETE Data deletion DELETE FROM CUSTOMER WHERE ...
CREATE TABLE Table creation CREATE TABLE TEST (...)

Mock Data (Sample Data)

To test actual queries, you need data. ThinkERD auto-generates sample data based on your ERD entity structure.

Data Generation Method

Drag and drop an entity from the canvas onto the Data Lab area to create its table and automatically populate it with mock data.

Column Type Generated Data
VARCHAR (name) Random names (e.g., "John Smith", "Jane Doe")
VARCHAR (code) Random codes (e.g., "A001", "B002")
INTEGER Random integers
DECIMAL Random decimals (amounts, etc.)
DATE Random dates
BOOLEAN true/false

Drop Menu

When you drop an entity, a menu appears:

Option Action
DDL + Mock Data Create table + insert sample data
DDL Only Create table structure only (no data)
SELECT Query Auto-generate a SELECT statement for the table

Notebook Mode

SQL Scratchpad supports managing multiple cells in a Notebook format.

Cell Management

Action Method
Add cell + Add button at the bottom
Run cell Individual cell's run button or Ctrl+Enter
Run all cells Execute all cells sequentially
Delete cell Delete button on the right side of the cell
Reorder cells Drag and drop to rearrange

Usage Scenarios

Validate with SQL that the ERD entity structure meets business requirements.

-- Cell 1: Check order count per customer
SELECT c.CUST_NM, COUNT(o.ORD_NO) as order_count
FROM CUSTOMER c
LEFT JOIN ORD o ON c.CUST_NO = o.CUST_NO
GROUP BY c.CUST_NM;
-- Cell 2: Find customers with no orders (FK relationship verification)
SELECT c.CUST_NM
FROM CUSTOMER c
WHERE NOT EXISTS (
  SELECT 1 FROM ORD o WHERE o.CUST_NO = c.CUST_NO
);

Write actual report queries ahead of time to verify the data structure's suitability.

-- Monthly sales summary (report prototype)
SELECT
  EXTRACT(MONTH FROM o.ORD_DT) as month,
  SUM(o.ORD_AMT) as total_sales,
  COUNT(*) as order_count
FROM ORD o
GROUP BY EXTRACT(MONTH FROM o.ORD_DT)
ORDER BY month;

Data Reset

Revert data modified by query execution to its initial state.

  • Full reset — Delete all tables and data, restoring a clean state
  • Drop entities again to rebuild with fresh mock data

In-Browser Execution

SQL Scratchpad runs entirely in the browser. It does not connect to external databases, so you can safely test queries without affecting company data.