---
title: "Join tables to combine data"
description: "Combine data from multiple tables using inner, left, and cross joins."
url: "https://www.pixeltable.com/notebooks/query-join-tables"
updated: "2026-04-10"
---

# Join tables to combine data

Combine data from multiple tables using inner, left, and cross joins.

- **Type:** Notebook
- **Group:** Core Operations

## How it works

Use table1.join(table2, on=..., how=...) to combine tables based on matching columns.

## What it covers

- Inner join to match rows from both tables
- Left join to keep all rows from the first table
- Cross join for Cartesian product (all combinations)
- Join with filtering, aggregation, and saving results
- Paginate results with limit() and offset

## What it uses

- **Install:** `pip install pixeltable`
- **Pixeltable calls:** `pxt.create_table()`, `insert()`, `join()`, `group_by()`

## A look at the code

```python
# Create a customers table
customers = pxt.create_table(
    'join_demo/customers',
    {'customer_id': pxt.Int, 'name': pxt.String, 'email': pxt.String},
)

customers.insert(
    [
        {'customer_id': 1, 'name': 'Alice', 'email': 'alice@example.com'},
        {'customer_id': 2, 'name': 'Bob', 'email': 'bob@example.com'},
        {
            'customer_id': 3,
            'name': 'Charlie',
            'email': 'charlie@example.com',
        },
    ]
)

customers.collect()
```

## Open it

- **Open in Colab:** https://colab.research.google.com/github/pixeltable/pixeltable/blob/release/docs/release/howto/cookbooks/core/query-join-tables.ipynb
- **Docs page:** https://docs.pixeltable.com/howto/cookbooks/core/query-join-tables
- **Source on GitHub:** https://github.com/pixeltable/pixeltable/blob/release/docs/release/howto/cookbooks/core/query-join-tables.ipynb
