# PARTITION BY

An OVER subclause dividing query rows into independent window-function groups.

## What is **PARTITION BY** in a relational database?

**PARTITION BY** — An OVER subclause dividing query rows into independent window-function groups.

```sql
SELECT order_id,
       SUM(total_amount) OVER (PARTITION BY customer_id) AS customer_total
FROM purchase_order;
```

Level: Journeyman · [More Database terms at this level](https://www.ask-codey.com/glossary/subjects/database/journeyman)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/partition-by
