# Common Table Expression (CTE)

A named query expression introduced by WITH for use within one statement.

## What is **Common Table Expression (CTE)** in a relational database?

**Common Table Expression (CTE)** — A named query expression introduced by WITH for use within one statement.

```sql
WITH open_order AS (
    SELECT order_id, customer_id
    FROM purchase_order
    WHERE status = 'open'
)
SELECT order_id
FROM open_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/common-table-expression-cte
