---
title: "Adding a Query to a Database"
slug: "add-query-external-database"
description: "This document shows how to use the Add Database button in the Database folder. By adding a query to a database, users can grab select items from that database table for use in Decisions."
updated: 2024-11-26T20:22:56Z
published: 2024-11-26T20:22:56Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding a Query to a Database

## Overview

Decisions allows users to add a query to an existing **Database Connection** during the**Database Integration** setup or after set up by using the functions found in the **System > Integrations >****Databases** folder; utilizing any of these folder actions like adding **Queries, Procedures, Tables,** and **V****iews** to a Database creates Flow steps for use in the **Flow Designer**. This method for retrieving data from the database is often used to speed up load times for large data collections.

---

## Example

1. To demonstrate this process of adding a query, the LOCAL CONNECTION database will be used due to it being on all Decisions instances.
2. Navigate to the integrated database under **System > Integrations > Database**. Right-click LOCAL CONNECTION and select **Add Query**.![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/image-1732569914767.png)
3. Enter a name for the query, representing its purpose (the name cannot contain spaces).
4. In the **Query** field, add the query. If the query returns data, check the **Returns Data** checkbox. It is not necessary to add a semicolon to the end of the query.
5. If a count attribute of the result set is desired, click the **Output Count** checkbox.
6. In the**Input Parameters** section, add Inputs to include on the Step generated from this Query.
7. Select **Run Query** to test the query. The **Results** tab shows the data returned (if the query returns data). The **Dynamic Type** tab shows the data structure of the data returned.  
![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/image-1732570271879.png)
8. Click **Save** to save the query.
9. Now, in the Flow Designer, under the components for the database, a component for running this query will be available.  
![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2024-11-26_15h21_15.png)

---

For further information on Integrations, visit the [Decisions Forum](https://community.decisions.com/categories/Integrations).
