# Database Interactions

Zephyr programs can interact with Mercury's database, enabling you to write, read, and update the data structures you define within it during execution. To access these data structures, simply define your tables in the `Zephyr.toml` file (more practical information on this is available in the database interactions section).

Therefore, data will be indexed and stored in the database according to your specified logic, allowing you to query it from your client later on.

### Querying from Mercury's Database

Once your data is indexed in the database tables, you have two options to query it:

1. Utilize our GraphQL API, which offers standardized queries and returns data in base64 XDR format.
2. Call a [Zephyr serverless function](#create-custom-callable-apis-serverless-functions): these functions can be set up as custom API endpoints, and allow you to customize various aspects, including the response format.

### Accessing Publicly Indexed Data

By default, Zephyr tables can be shared across programs. Creators will have the ability to control access to their tables using custom rules. This feature enables any program or custom dashboard to access indexed and live-updated data on Mercury.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mercurydata.app/zephyr-full-customization/general-concepts/database-interactions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
