Try SQL without saving a test
Run a query in the Scratchpad, or on a practice copy of the sample database that is yours alone, and save nothing until you choose to.
In short
Run SQL and read the rows before you save anything as a test. The "Scratchpad" tab runs one statement against the sample database; nothing is kept as a test until you press "Save as test". When you may not add the sample database to a shared workspace, SQL Tester opens on a practice copy instead, "Try it (not saved)", held for you alone.
Before you start
- Who: anyone with SQL Tester on. Running in the Scratchpad needs Edit on the project; the practice copy is yours alone.
- Plan: SQL Tester is part of every plan; Plan & usage shows your run limits. A practice-copy run uses none of your plan's SQL executions.
- First: nothing to connect. The first screen offers the sample database.
Steps
- Open SQL Tester and choose the "Scratchpad" tab. On your first visit, press "Run the sample query" on the "Sample database" card and the Scratchpad opens by itself.
- Type a statement under "SQL", or keep the one that is there. Leave "Transaction" on "Roll back always" so nothing you run changes the database.
- Press "Run". The result grid shows the rows.
- Read the result. Find the run again later under "Your recent runs". Press "Save as test" only when you want to keep it as a test.
Result: you have run real SQL without making a test. "Connect your own" on the first screen is the way to your own database.
Make your first check
After the first query on the sample, or on a database you just connected, a "Keep it as a test" card appears under the result. A check runs the query again later and fails when the answer changes.
- Under "What must stay true", pick one: a value in the first row (for example "answer is 42"), how many rows came back, or, when nothing came back, that it runs without an error.
- Keep or change the "Check name".
- Press "Save and run the check". The query is saved as a test with that one check and runs at once.
- Read the verdict. "Open the check" takes you to it in Tests, where you can add more checks.
"Not now" closes the card; "Save as test" still keeps the query with the full editor. The card needs Edit on the project.
When you may not add the sample
A member who may not add the sample to a shared workspace sees "Try it (not saved)", marked "Only you", on the first screen instead of the "Sample database" card.
- Read the Tables line to see what the practice database holds. Press a "Sample queries" button to fill the query, or type your own under "Your query".
- Press "Run". The result grid shows the rows.
- To go back to the starting data, press "Start over".
Good to know
- Scratchpad runs are kept under your name for 30 days, and only you see them. Clicking one loads it back into the editor.
- The practice copy is a database of its own for you and this workspace. Nobody else sees what you change, and the workspace's sample is never touched.
- On the practice copy a statement that changes tables runs as a script and is rolled back by default. Nothing is written, so there is no project, run or snapshot and no "why did this fail" or comparison.
- The usual limit on runs a minute applies to both.
If something goes wrong
- "Changing this project needs Edit on it.": "Run" is closed for you in the Scratchpad. Ask whoever manages the project for Edit.
- "Type a query first.": the query box of the practice copy is empty.
- "The sample database is not available on this server - connect a database instead.": use "Connect your own".
Related
- /help/sql-tester/start-here
- /help/sql-tester/connections-and-environments
- /help/settings/examples