Skip to content
/Chapter 9 · Query Debugging and Common Mistakes
Lesson 9.1·garden_shop
Lesson 9.1

Reading SQL Error Messages

Error messages tell you what went wrong and often suggest the fix. The skill is slowing down to read them.

Everyone writes queries that fail. The difference between frustration and a quick fix is reading the error instead of panicking. SQL engines tell you what they choked on, and DuckDB often suggests the column you probably meant.

The query below won't run. Click Run first, read what comes back, and let the message guide your fix. You will see a "Referenced column… not found" error pointing at the real problem.

Pattern
-- DuckDB error messages point right at the problem:
-- Binder Error: Referenced column "prize" not found
-- Candidate bindings: "price"
Schema · Garden ShopTable · products9 columns · 24 rows
Table · products

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

9 columns · 24 rows
product_id intproduct_name textcategory_id intsupplier_id intprice decimalcost decimalquantity_on_hand intreorder_level intdiscontinued bool
Your task

The starter query is broken. Run it, read the error, and fix it so it returns the 5 most expensive products, theirproduct_name and price, most expensive first.

SQL Workbench
query.sqlgarden_shop · SQL engine loading
⌘↵ to run
·
Expected answer
  • Columns: product_name, price.
  • Rows: the 5 most expensive products.
  • The Fiddle-Leaf Fig leads at 32.