SQL Scratchpad¶
SQL Scratchpad is a SQL editor that lets you query ERD entity data directly in the browser.
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¶
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.