> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/gridgain/gridgain-8/gridgain8-development/accessing-data/sql.md).

# Working with SQL

Work with GridGain's distributed SQL database, including the SQL API, schemas, indexes, joins, custom functions, and combined SQL and key-value access.

GridGain comes with an ANSI-99 compliant, horizontally scalable, and fault-tolerant distributed SQL database. This section covers using SQL in GridGain, including an introduction to the SQL engine, the SQL API, schemas, indexes, distributed joins, custom SQL functions, and combining SQL with the key-value API.

{% columns %}
{% column %}
{% content-ref url="/pages/19yBMxyqvJX7aMPV7B2T" %}
[Introduction](/docs/gridgain/gridgain-8/gridgain8-development/accessing-data/sql/sql-introduction.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
An introduction to GridGain's distributed SQL database, covering simple, distributed, and local queries, distributed joins, aggregation, and timezones.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/UaIU0zlp3N14ZgfQkpKB" %}
[Understanding Schemas](/docs/gridgain/gridgain-8/gridgain8-development/accessing-data/sql/schemas.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
GridGain provides default schemas and supports custom schemas, defined in configuration or created automatically for each cache.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/rLMmDJ4ucd2B9tE5WBvy" %}
[Defining Indexes](/docs/gridgain/gridgain-8/gridgain8-development/accessing-data/sql/indexes.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Define GridGain SQL indexes and queryable fields using annotations or query entities, configure group indexes, inline size, and custom keys.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/u4tShTLRPgU48F0UrDDY" %}
[SQL API](/docs/gridgain/gridgain-8/gridgain8-development/accessing-data/sql/sql-api.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Use GridGain's SQL API to configure queryable fields, run queries, execute DML and DDL, specify schemas, and cancel long-running queries.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/Vm2d8wyEM7vTfbcrfdX9" %}
[Distributed Joins](/docs/gridgain/gridgain-8/gridgain8-development/accessing-data/sql/distributed-joins.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Understand the GridGain collocation model for SQL joins and how to run collocated and non-collocated joins correctly.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/0U4uN2y7ccfHBKJsYzrl" %}
[Custom SQL Functions](/docs/gridgain/gridgain-8/gridgain8-development/accessing-data/sql/custom-sql-func.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Extend the GridGain SQL function set with custom SQL functions written in Java and annotated with @QuerySqlFunction.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/n4yaIom0apA2p6NGOUMc" %}
[SQL and Key-Value Usage](/docs/gridgain/gridgain-8/gridgain8-development/accessing-data/sql/sql-key-value-storage.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Access cached data with both SQL and the key-value API, using a sample project that creates a SQL schema and queries it both ways.
{% endcolumn %}
{% endcolumns %}
