# Summarise the whole table

Shape / table

A variant of [Summarise by group](https://meridian.online/operations/summarise-by-group).

Reduce the entire table to a single summary row, without grouping keys.

Page: <https://meridian.online/operations/summarise-by-group/summarise-whole-table>

## Status

Runs as a SQL step.

arcform carries it as a `sql:` step today.

## The DuckDB step

summarise the whole table into one row

It reads the `orders` and `customers` tables the proofs share. Create them first:

```sql
CREATE TABLE orders AS SELECT * FROM (VALUES
  (1,  'Alice Ng',      'north', DATE '2026-01-03', 120.00, 'widget', 'a|b',   '{"channel":"web","items":[1,2]}'),
  (2,  'alice ng',      'north', DATE '2026-01-05',  80.50, 'gadget', 'b',     '{"channel":"shop","items":[3]}'),
  (3,  'Bob  Okafor',   'south', DATE '2026-01-05', 300.00, 'widget', 'a|c',   '{"channel":"web","items":[4,5,6]}'),
  (4,  'Carla Díaz',    'east',  DATE '2026-01-09',  NULL,  'gizmo',  NULL,    '{"channel":"web","items":[]}'),
  (5,  'Bob Okafor',    'south', DATE '2026-01-12',  45.25, 'gadget', 'c',     '{"channel":"phone","items":[7]}'),
  (6,  'Dev Patel',     'west',  DATE '2026-01-12', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (7,  'Carla Diaz',    'east',  DATE '2026-01-20',  99.99, 'gizmo',  'b|c',   '{"channel":"shop","items":[10]}'),
  (8,  'Dev Patel',     'west',  DATE '2026-02-02', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (9,  'Eve Larsen',    NULL,    DATE '2026-02-03',  15.00, 'gadget', NULL,    '{"channel":"web","items":[11]}'),
  (10, 'Alice Ng',      'north', DATE '2026-02-10', 220.00, 'gizmo',  'a|b|c', '{"channel":"phone","items":[12,13]}')
) t(order_id, customer, region, order_date, amount, product, tags, meta);

CREATE TABLE customers AS SELECT * FROM (VALUES
  ('Alice Ng',    'retail',    DATE '2025-06-01', 52.52, 13.40),
  ('Bob Okafor',  'wholesale', DATE '2025-09-15', 48.85,  2.35),
  ('Carla Diaz',  'retail',    DATE '2025-11-30', 40.42, -3.70),
  ('Frank Moore', 'retail',    DATE '2026-01-01', 51.51, -0.13)
) t(customer, segment, joined, lat, lon);
```

Then run the statement:

```sql
CREATE TEMP TABLE summary AS
SELECT count(*) AS orders, count(amount) AS priced, sum(amount) AS total, round(avg(amount), 2) AS mean,
       min(amount) AS smallest, max(amount) AS largest, count(DISTINCT customer) AS customers,
       min(order_date) AS first_day, max(order_date) AS last_day
FROM orders;
-- an empty input still gives one row
CREATE TEMP TABLE from_nothing AS SELECT count(*) AS orders, sum(amount) AS total FROM orders WHERE false;
SELECT * FROM summary;
SELECT CASE WHEN ((SELECT count(*) FROM summary) = 1 AND (SELECT (orders, priced, total, mean, smallest, largest, customers, first_day, last_day) FROM summary) = (10, 9, 1900.74, 211.19, 15.00, 510.00, 8, DATE '2026-01-03', DATE '2026-02-10') AND (SELECT count(*) FROM from_nothing) = 1 AND (SELECT orders FROM from_nothing) = 0 AND (SELECT total FROM from_nothing) IS NULL) THEN 'as expected' ELSE error('the table did not reduce to one row of 10 orders, 9 priced, totalling 1900.74, or an empty table did not give one row of zero') END AS verdict;
```

It needs nothing installed beyond DuckDB itself.

## What other tools call it

Meridian's classification; an independent blind rating agreed on 95.7% of 324 rows (variant, version 3).

- Alteryx Designer: [`Count Records`](https://help.alteryx.com/current/en/designer/tools/transform/count-records-tool.html) (read 2026-09-27)
- Apache DataFusion: [`count`](https://docs.rs/datafusion/latest/datafusion/dataframe/struct.DataFrame.html) (read 2026-09-27)
- Duckle: [`Count Rows`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`Diff Summary`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Polars: [`DataFrame.count`](https://docs.pola.rs/api/python/stable/reference/dataframe/aggregation.html) (read 2026-09-27)
- Polars: [`DataFrame.max`](https://docs.pola.rs/api/python/stable/reference/dataframe/aggregation.html) (read 2026-09-27)
- Polars: [`DataFrame.mean`](https://docs.pola.rs/api/python/stable/reference/dataframe/aggregation.html) (read 2026-09-27)
- Polars: [`DataFrame.median`](https://docs.pola.rs/api/python/stable/reference/dataframe/aggregation.html) (read 2026-09-27)
- Polars: [`DataFrame.min`](https://docs.pola.rs/api/python/stable/reference/dataframe/aggregation.html) (read 2026-09-27)
- Polars: [`DataFrame.product`](https://docs.pola.rs/api/python/stable/reference/dataframe/aggregation.html) (read 2026-09-27)
- Polars: [`DataFrame.quantile`](https://docs.pola.rs/api/python/stable/reference/dataframe/aggregation.html) (read 2026-09-27)
- Polars: [`DataFrame.std`](https://docs.pola.rs/api/python/stable/reference/dataframe/aggregation.html) (read 2026-09-27)
- Polars: [`DataFrame.sum`](https://docs.pola.rs/api/python/stable/reference/dataframe/aggregation.html) (read 2026-09-27)
- Polars: [`DataFrame.var`](https://docs.pola.rs/api/python/stable/reference/dataframe/aggregation.html) (read 2026-09-27)
- RapidMiner Studio: [`Extract Aggregates`](https://docs.rapidminer.com/latest/studio/operators/modeling/time_series/feature_extraction/extract_std_descriptive_features.html) (read 2026-09-27)
- RapidMiner Studio: [`Extract Mode`](https://docs.rapidminer.com/latest/studio/operators/modeling/time_series/feature_extraction/extract_mode.html) (read 2026-09-27)
- VisiData: [`freq-summary`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/freqtbl.py#L206) (read 2026-09-23)
- VisiData: [`memo-aggregate`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/aggregators.py#L410) (read 2026-09-23)
