# Run SQL Query

The SQL Query Step allows you to run queries directly against your connected databases. This can be useful for pulling data into your workflows, or even building out workflows focused on writing directly to your databases.

## Configuring a "SQL Query" Step

The SQL Query Step is fairly straightforward. The only prerequisite is that you have connected a SQL database via a read user. See our documentation page on [Connecting Datasources](/context/memory-stores/add-data/import-from-sql-database/data-sources.md) for more information.

Once you have successfully connected a data source, you can add a SQL Query Step into your Workflows as shown below:

{% @arcade/embed url="<https://app.arcade.software/share/10JanDKu9KE0Ahb7n7Fp>" flowId="10JanDKu9KE0Ahb7n7Fp" %}

One of the most powerful use-cases we've seen for our SQL Query Step is to power an Agent to assist with writing and editing your own queries. It was so popular, that we built our "Data Sidekick" Agent template around it.

As you start to dig into your use-cases more deeply, we would recommend giving it a quick peek behind the curtains:

<figure><img src="/files/N8uCvlBSOhuA3UCzI2b9" alt=""><figcaption><p>Using a SQL Query Step to power our "Data Sidekick" Agent</p></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://docs.airops.com/actions/workflow-concepts/workflow-steps/logic-steps/sql-query.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.
