SQL Playground Mission: Map a Dataset Before Querying
Start freeform SQL work by building a quick map of table sizes.
Before writing a report on an unfamiliar dataset, map the tables. A row-count inventory tells you which tables are small lookup tables, which tables hold transactional detail, and where a join might multiply rows.
This mission uses
UNION ALL
to stack one small count query per table. It is the same habit you can use
in the playground before exploring your own CSV or Parquet upload.
The missions use the small datasets so every answer can be checked by eye. For the same work at scale, the practice datasets include tables of hundreds of thousands of rows, each with its own practice questions.
select 'first_table' as table_name, count(*) as rows from first_table
union all
select 'second_table', count(*) from second_table
order by rows desc, table_name Schema · Garden Shop View dataset schema 6 tables
One row per customer. Some customers have no phone on file.
One row per product, with price, cost, and inventory levels.
Lookup table of product categories.
One row per order. Unshipped orders have a null shipped_date.
One row per line item within an order.
One row per supplier. Some suppliers have no contact email.
Return a table inventory for Garden Shop. The result should have
table_name and rows, covering customers, products,
categories, orders, order_items, and suppliers. Sort by row count
descending, then table name.
Run your query to inspect the result.
Expected answer
- Columns: table_name, rows.
- Rows: one per Garden Shop table (6 rows).
- order_items is largest with 48 rows; suppliers is smallest with 6 rows.
Related
Clause order and the shape of a SELECT query.
SELECT, WHERE, ORDER BY, and LIMIT at a glance.
Practice aggregate reports, HAVING, and answer shape.
Avoid truncating fractional results.
WHERE is evaluated before SELECT aliases exist.
COUNT, SUM, AVG, MIN, MAX, GROUP BY, and HAVING.