# Creating queries

## Step 1 - Add a new query

First, navigate to queries in the top nav and click '+' to add a new query.

<figure><img src="/files/MsJa6NwKiW2dMJlKgWEB" alt=""><figcaption></figcaption></figure>

Name your new query anything you like.

<figure><img src="/files/yGvcLDNrpRqX73ly8qb3" alt=""><figcaption></figcaption></figure>

## Step 2 - Write your SQL

After adding a query, you will be redirected to the query page and able to customize your SQL query. Web3 Analytics uses the [Presto SQL syntax](https://prestodb.io/docs/current/index.html).

<figure><img src="/files/LPkSh7Pw19fhKkx3C5FK" alt=""><figcaption></figcaption></figure>

All data is stored in the 'events' table, and the default query is:

```
SELECT * from events;
```

On queries you have created, a list of available fields and their datatype is shown to the left of the SQL editor.&#x20;

Clicking on a field name will insert a reference to the field where your cursor is in the SQL editor.

## Step 3 - Run your query

If you run your query, you can browse through results 100 records at a time. Your query is saved every time it is successfully run.&#x20;

You can also filter the data or download it as a CSV file.

<figure><img src="/files/lP8lz8LUakzWAlKisQMT" alt=""><figcaption></figcaption></figure>


---

# 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://web3-analytics.gitbook.io/product-docs/product-guides/creating-queries.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.
