Skip to content
/ Chapter 1 · Welcome to the Shed
Lesson 1.2 · garden_shop
Lesson 1.2

Your First SQL SELECT Statement

A SELECT query chooses columns from a table and returns a result.

The first SQL pattern to learn is SELECT plus FROM. SELECT says which columns you want, and FROM says which table to read.

LIMIT is useful while learning because it keeps the result small. Which rows count as "first" is up to the database until you sort them, which Lesson 1.6 covers.

Pattern
select column_one, column_two
from table_name
limit 5

When to use SELECT

Use SELECT when you want to inspect data without changing it. A good first query asks for a few named columns from one table, then limits the result so you can check the shape before adding filters, joins, or calculations.

Avoid starting every query with select *. It is useful for quick exploration, but named columns make the result easier to read, make dependencies explicit, and avoid unexpectedly pulling newly added columns into downstream results.

Schema · Garden Shop Table · products 9 columns · 24 rows
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
Your task

Show each product's product name and price. Keep the result to the first 5 rows.

·

Run your query to inspect the result.

Expected answer
  • Columns: product_name, price.
  • Rows: 5 products.