Skip to content
/Chapter 2 · Data Types Before Deep Querying
Lesson 2.1·garden_shop
Lesson 2.1

Why SQL Data Types Matter

SQL uses column types to decide how values compare, sort, and calculate.

Every column has a type. A column might hold text, numbers, dates, booleans, or missing values. SQL uses those types when it sorts, compares, filters, and calculates.

The difference matters quickly. Sorting product names alphabetically is different from sorting product prices numerically.

Pattern
select column_one, number_column
from table_name
order by number_column desc
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

Show each product's product name and price, sorted from the highest price to the lowest. Keep only the first 5 rows.

SQL Workbench
query.sqlgarden_shop · SQL engine loading
⌘↵ to run
·
Expected answer
  • Columns: product_name, price.
  • Rows: 5 products.
  • The first row should be Fiddle-Leaf Fig at 32.00.