surfaceanalysiscompare
Analysisaggregate · returns varchar

COMPARE

Compare values in a group for similarities, differences, and patterns

Per-group — reads the whole group in one call.

analysisllmtext

Syntax

COMPARE({{ values }})
COMPARE({{ values }}, '{{ focus }}')

Arguments

nametypedescription
valuesVARCHARValues to compare
focus(optional)VARCHARFocus: differences, similarities, changes, all

About

Compare a group of values side-by-side and return a structured summary of their similarities, differences, and patterns. Useful for data reconciliation, change detection across versions, or quick insight into what's shared vs. unique across a cohort. Common uses: comparing product descriptions across vendors, reconciling customer profile fields pulled from different systems, surfacing drift between versions of a document, spotting which support tickets in a cluster share a root cause. Pass an optional `focus` argument to steer what to look at (`'price differences'`, `'tone'`, `'factual consistency'`); default is `all`. Returns a JSON object with similarity, difference, and pattern sections.

Examples

Compares iPhone models to find differences

WITH
  test_data AS (
    SELECT
      *
    FROM
      (
        VALUES
          ('iPhone 15: $999, 6.1" display, A16 chip'),
          (
            'iPhone 15 Pro: $1099, 6.1" display, A17 Pro chip'
          ),
          (
            'iPhone 15 Pro Max: $1199, 6.7" display, A17 Pro chip'
          )
      ) AS t (phone)
  )
SELECT
  COMPARE (phone, 'differences')
FROM
  test_data

Nearby rabbit holes

same domain
Climb back to The Looking Glass