The WHERE Clause: an overview
Add a WHERE clause to return only the rows that match a condition, such as customers in the UK.
Novice · SQL · MySQL · Updated
The WHERE clause is used to add filters and include only the rows that match your criteria.
SELECT customer_id
, company_name
, country
, order_id
, product_name
, sales_price
, quantity
, sales_price * quantity
FROM customer_orders
WHERE country = 'UK'
ORDER BY customer_id
, order_id;
In this example we only want to return order details for customers who are located in the UK.

Do it: find the customers in Germany
The sales team is planning a trip to Germany and wants a list of the customers there, sorted by city so the visits can be planned town by town.
The customers table (the Tables tab shows the SQL that makes it) has these rows:
| company_name | city | country |
|---|---|---|
| Alfreds Futterkiste | Berlin | Germany |
| Around the Horn | London | UK |
| Blauer See Delikatessen | Mannheim | Germany |
| Bon app' | Marseille | France |
| Königlich Essen | Brandenburg | Germany |
| Seven Seas Imports | London | UK |
Your query should give exactly these rows, in this order:
| company_name | city |
|---|---|
| Alfreds Futterkiste | Berlin |
| Königlich Essen | Brandenburg |
| Blauer See Delikatessen | Mannheim |
Your job: write one SELECT query that lists the customers in Germany.
- Show two columns,
company_nameandcity, in that order. - Keep only the rows whose
countryis'Germany'. - Sort them by
city, A to Z.
Practiced live on the lesson page: write the SQL right there and check it.