Skip to main content

Overview

This page provides the ANTLR4 grammar specification for CoinbaSeQL (pronounced “coinbase QL”), the SQL dialect used by the SQL API.
This page is designed for AI/LLM consumption. If you’re using AI tools like ChatGPT, Claude, or Cursor to help write SQL queries, provide this grammar along with the schema reference to generate syntactically correct queries.
CoinbaSeQL supports all standard SQL query features. For practical examples and usage, see:
  • Quickstart - Try queries in the SQL Playground
  • Schema Reference - Explore available tables and columns
  • FAQ - Common questions about supported features

For AI tools and query validators

The complete ANTLR4 grammar specification below defines exactly what SQL syntax is supported by CoinbaSeQL.

Design Principles

CoinbaSeQL is created with the following principles:
  • As similar to standard SQL as possible
  • Support all common SQL features per the SQL standard
  • Provide understandable, actionable, and helpful error messages

Grammar Specification

You can also retrieve this grammar programmatically via the Get SQL Grammar endpoint.

How to use this with AI tools

When using AI assistants to write SQL queries:
  1. Provide context: Give your AI tool both this grammar specification and the schema reference
  2. Be specific: Ask for queries that match your specific use case (e.g., “Write a query to find all USDC transfers over $1000 in the last 24 hours”)
  3. Validate: Always test AI-generated queries in the SQL Playground before using them in production
Providing this grammar helps LLMs generate queries that pass CoinbaSeQL validation on the first try.