Practice Exercise: Using WHERE
Let’s do a quick practice exercise to make sure the idea of WHERE is crystal clear. Once again, we are working with a table called phones. Each row in this table represen
Let’s do a quick practice exercise to make sure the idea of WHERE is crystal clear.
Once again, we are working with a table called phones.
Each row in this table represents a different phone and contains information like:
- phone name
- manufacturer
- price
- units sold
🎯 Goal of This Exercise
Write a SQL query that will:
- print the name
- and price
- of every phone that sold more than 5000 units
In simple words:
We only want phones whereunits_soldis greater than5000.
🧠 How to Think About It
Ask yourself these questions:
1. Which table am I selecting from? 2. → phones 3. Which columns do I want to display? 4. → name, price 5. What condition should filter the rows? 6. → units_sold > 5000
✍️ Your Task
Try writing the SQL query yourself before looking at the solution.
Use what you’ve learned:
SELECTto choose columnsFROMto choose the tableWHEREto filter rows
Take a moment and give it a try 👇
(If you get stuck, no stress — we’ll walk through the solution next.)
Solution: Filtering with WHERE
Let’s walk through the solution step by step and make sure everything makes sense.
Step 1: Decide What We’re Doing
We are from the database, so we know our query must start with the keyword.

