📖 Worked Example: Building SQL Queries

Follow along as we build SQL queries step by step!

Reference: products table

id name category price stock
1LaptopElectronics899.9915
2MouseElectronics29.99150
3DeskFurniture249.9925
4ChairFurniture179.9940
5MonitorElectronics349.9930
6KeyboardElectronics79.9985

Query Building Process

1

Identify what you need

What columns do you want? What conditions must be met?

2

Start with SELECT

List the columns you want, or use * for all.

3

Add FROM

Specify which table contains the data.

4

Add WHERE (if needed)

Filter results with conditions using =, >, <, AND, OR.

Next: Trace Query Execution → ← Back to Predict