Skip to main content
On this page

Kater SQL Functions Aggregations

KATER__COUNT

How many rows have a value in the field.

Family: Aggregations

Syntax

KATER__COUNT(field)

Arguments

ArgumentDescription
fieldThe field to aggregate.

Returns

A whole number. The field menu writes @format number(0) beside it.

Usage notes

  • It compiles to COUNT(field), so a row whose field is empty is not counted.
  • To count every row, count a field that is never empty, such as an ID.

Example

This Sandbox query reads the sample shop’s orders. The table shows the rows that Kater gave.

SELECT
orders.channel AS "Channel",
KATER__COUNT(orders.order_id) AS "Orders",
KATER__COUNT(orders.notes) AS "Orders with Notes"
FROM kater_dataset.orders AS orders
GROUP BY
orders.channel
ORDER BY
1
ChannelOrdersOrders with Notes
email778444
paid762442
store754455
web706415

Compiles to

The call compiles to the same SQL on DuckDB and on Snowflake.

COUNT(orders.order_id)

See also