Pick the single best value from a group by a plain-English quality criterion
Per-group — reads the whole group in one call.
BEST({{ values }})BEST({{ values }}, '{{ criteria }}')| name | type | description |
|---|---|---|
| values | VARCHAR | Values to choose from |
| criteria(optional) | VARCHAR | Selection criteria: 'most complete', 'most recent', 'shortest', etc. |
Selects best quality email from group
WITH
test_data AS (
SELECT
*
FROM
(
VALUES
('john@gmail.com'),
('JOHN@GMAIL.COM'),
('j@gmail.com'),
(NULL)
) AS t (email)
)
SELECT
BEST (email, 'highest quality')
FROM
test_dataReturns 0.0-1.0 relevance score for text vs criterion (cross-encoder)
LLM-backed 0.0-1.0 relevance score (escape hatch for ABOUT/RELEVANCE TO)
Find unusual or atypical items via embeddings (+ optional criteria)
LLM-backed outlier detection (escape hatch for OUTLIERS)
PageRank centrality on an ad-hoc edge list (NetworkX)
Rank a group of items by a subjective multi-factor criterion
Pick the single best value from a group by a plain-English quality criterion
Per-group — reads the whole group in one call.
BEST({{ values }})BEST({{ values }}, '{{ criteria }}')| name | type | description |
|---|---|---|
| values | VARCHAR | Values to choose from |
| criteria(optional) | VARCHAR | Selection criteria: 'most complete', 'most recent', 'shortest', etc. |
Selects best quality email from group
WITH
test_data AS (
SELECT
*
FROM
(
VALUES
('john@gmail.com'),
('JOHN@GMAIL.COM'),
('j@gmail.com'),
(NULL)
) AS t (email)
)
SELECT
BEST (email, 'highest quality')
FROM
test_dataReturns 0.0-1.0 relevance score for text vs criterion (cross-encoder)
LLM-backed 0.0-1.0 relevance score (escape hatch for ABOUT/RELEVANCE TO)
Find unusual or atypical items via embeddings (+ optional criteria)
LLM-backed outlier detection (escape hatch for OUTLIERS)
PageRank centrality on an ad-hoc edge list (NetworkX)
Rank a group of items by a subjective multi-factor criterion