Meet the SQL Workbench
The workbench is where you try SQL, read results, and fix mistakes.
Every interactive lesson has the same workbench. Here is each part and what it does:
- The editor is where you write SQL. Press Ctrl + Enter (⌘ + Enter on a Mac) to run without reaching for the mouse.
- Run query runs what is in the editor and shows the result or the error underneath.
- Format tidies the layout of your query: line breaks and indentation. It never changes what the query does.
- Reset puts the starter query back and clears the result.
- Share copies a link that opens this lesson with your query in the editor. The query travels inside the link.
- Hint shows one hint at a time, and Reveal solution puts a working answer in the editor.
- Expected answer describes the columns and rows a correct query returns, so you can check your own result against it.
- The schema panel above the workbench lists the dataset's tables and columns. Check spellings there.
Errors are part of the workflow. A useful SQL habit is to run a query, read the message, make one small fix, and run it again.
select column_one, column_two
from table_name
limit 5 Schema · Garden Shop Table · products 9 columns · 24 rows
One row per product, with price, cost, and inventory levels.
Run the starter query to see what happens, then fix it so it shows each product's product name, price, and quantity on hand for the first 5 rows.
Run your query to inspect the result.
Expected answer
- Columns: product_name, price, quantity_on_hand.
- Rows: 5 products.
- The query should run without an error.
Related
Clause order and the shape of a SELECT query.
SELECT, WHERE, ORDER BY, and LIMIT at a glance.
WHERE is evaluated before SELECT aliases exist.
The parser stopped at the first word it could not use.
No table in the FROM clause has that column.
Understand tables, rows, columns, and queries.