Skip to content
/ Chapter 17 · Guided Playground Missions
Lesson 17.1 · garden_shop
Lesson 17.1

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.

Pattern
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
Table · customers

One row per customer. Some customers have no phone on file.

9 columns · 20 rows
customer_id int first_name text last_name text email text phone text city text state text signup_date date is_active bool
Table · products

One row per product, with price, cost, and inventory levels.

9 columns · 24 rows
product_id int product_name text category_id int supplier_id int price decimal cost decimal quantity_on_hand int reorder_level int discontinued bool
Table · categories

Lookup table of product categories.

2 columns · 8 rows
category_id int category_name text
Table · orders

One row per order. Unshipped orders have a null shipped_date.

6 columns · 24 rows
order_id int customer_id int order_date date shipped_date date status text coupon_code text
Table · order_items

One row per line item within an order.

5 columns · 48 rows
order_item_id int order_id int product_id int quantity int unit_price decimal
Table · suppliers

One row per supplier. Some suppliers have no contact email.

4 columns · 6 rows
supplier_id int supplier_name text contact_email text state text
Your task

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.