# Query block

By using the `/query` command, editors can embed live queries into table documentation, glossary terms, docs, questions and collections. This allows users to preview the data directly in Secoda.

## Running a query

1. Add a query block using the `/query` command
2. Select a source to run the query on
3. Write your query and press the "Run" button on the right hand side
4. View the query results share it with other users
5. Optionally, rename the query block

<figure><img src="https://secoda-public-media-assets.s3.amazonaws.com/062f5729-af95-4544-85da-692101614dd1.gif" alt=""><figcaption></figcaption></figure>

## Sharing queries

Query blocks are useful for showing viewers how to use queries or if editors want to share queries for viewers. Viewers are unable to execute queries but can read the results of the query blocks and view the query. Query blocks can be directly linked to with the `Copy link` option

<figure><img src="https://secoda-public-media-assets.s3.amazonaws.com/0edb3b26-cb55-4248-902d-3623935d9b53.png" alt=""><figcaption></figcaption></figure>

## Exporting query results

An admin or editor can export the full list of data associated with the query results to CSV. The download option is found at the bottom of the query block.

<figure><img src="https://secoda-public-media-assets.s3.amazonaws.com/00f67df7-9ea0-4b23-af31-f5c674e39806.png" alt=""><figcaption></figcaption></figure>

## Query rermissions

If you would like to turn off the ability to run queries in query blocks, you can do so in the Integration settings. You can modify these preferences only as an Admin. To modify the preferences, go to the Integration > Preferences > Query Permissions

{% hint style="info" %}
**NOTE:** By default, editors do not have the permissions enabled for running queries on integrations. You can enable these permissions by going to the permissions tab in the integrations setting page.
{% endhint %}

{% hint style="info" %}
Not using Secoda to manage your data documentation yet? Sign up for free [here](http://app.secoda.co/) 👈
{% endhint %}


---

# 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.secoda.co/features/queries/running-queries-in-secoda.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.
