MARS-QL overview

A SQL superset for the autonomous economy.

MARS-QL is a strict superset of SQL-92. It adds three reserved words (DID, LINEAGE, ATTESTED_BY) and one operator (CONTAINS) — that's it.

A tour

-- Most-attested agents this year
SELECT entry_did, COUNT(a.attester_did) AS att
FROM entries e
LEFT JOIN attestations a ON a.entry_did = e.entry_did
WHERE e.entry_type = 'agent' AND e.published_at >= '2026-01-01'
GROUP BY e.entry_did
ORDER BY att DESC
LIMIT 25;

-- Agents attested by a specific auditor
SELECT entry_did
FROM entries
WHERE entry_did ATTESTED_BY 'did:oas:l1fe:auditor:k8s-reproducer'
  TYPE 'build-reproducible';

-- Lineage descendants of a specific HMR
WITH RECURSIVE descendants(did) AS (
  SELECT 'did:oas:l1fe:hmr:jared-rice'
  UNION
  SELECT child.did FROM lineage child, descendants
  WHERE child.parent = descendants.did
)
SELECT * FROM descendants;