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

Steps

  1. 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.
  2. 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.
  3. Press "Run". The result grid shows the rows.
  4. 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.

  1. 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.
  2. Keep or change the "Check name".
  3. Press "Save and run the check". The query is saved as a test with that one check and runs at once.
  4. 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.

  1. 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".
  2. Press "Run". The result grid shows the rows.
  3. To go back to the starting data, press "Start over".

Good to know

If something goes wrong

Related