# 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 November 16, 2026

By Gregor Dzierzon

The WHERE clause is used to add filters and include only the rows that match your criteria.

```sql
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.

![The same query with WHERE country = 'UK' added: every row in the result is a UK customer, such as Around the Horn](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/09/e67603c6af4f42edb5f7a0624402c98a.png)

## 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_name` and `city`, in that order.
- Keep only the rows whose `country` is `'Germany'`.
- Sort them by `city`, A to Z.

Practiced live on the lesson page: write the SQL right there and check it.

## Cheat sheets

- [The WHERE Clause](https://www.ask-codey.com/cheat-sheets/the-where-clause-an-overview-cheat-sheet)

Source: https://www.ask-codey.com/lessons/the-where-clause-an-overview
