---
title: "Database Query Set"
canonical: "https://help.innovyze.com/space/infowaterpro/18055595/Database%20Query%20Set"
format: markdown
---
A query of a database allows you to extract a record (or records) of a data using logical statements on a field (or fields) stored within a specific database. With InfoWater Pro, you are able to select network components and related data by creating logical query statements through the user-friendly DB Query feature.

## Using Queries in InfoWater

DB Query is a time-saving tool that can be used for:

- Activating a portion of the network for simulation, typically as a facility set associated with a custom scenario (see [Facility Manager](https://help-innovyze.atlassian.net/wiki/spaces/infowaterpro/pages/18055541)).
- Creating a domain to highlight a subset of network components (see [Domain Manager](https://help-innovyze.atlassian.net/wiki/spaces/infowaterpro/pages/18055548)).
- Restricting the database records that are available for editing using the Database Editor.
- Customizing the map display by color-coding network components (see [Query Sets](https://help-innovyze.atlassian.net/wiki/spaces/infowaterpro/pages/18055595)).
- Creating Selection Sets (see [Selection Sets](https://help-innovyze.atlassian.net/wiki/spaces/infowaterpro/pages/18055556)).
- [Output Relates](https://help-innovyze.atlassian.net/wiki/spaces/infowaterpro/pages/18056166) (stored output result data) can also be associated with DB Queries which are important when creating [Query Reports](https://help-innovyze.atlassian.net/wiki/spaces/infowaterpro/pages/18056136).
- Restricting model results to identify network components whose modeled performance (pressures, flows, etc.) meet or do not meet user specified criteria (e.g., nodes where pressure drops below 20 psi) using the Output Report Manager.

You may develop your own query statements or use one of the pre-defined InfoWater Pro special queries to select portions of your distribution system model.


## Methodology

To build a query statement, do the following:

- Click **DB Query** from the **InfoWater Browser** →  **Operation**** tab**.
- Right click and choose the **New **command, and specify an ID and description (ID is no more than 20 characters, no spaces, and Description is no more than 60 characters, may contain spaces) and click **OK**.
- Choose the **Element Type** that you want to create a query for (choose from **Junctions**, **Pumps**, **Tanks**, **Reservoirs**, **Valves**, and **Pipes**), and then click **OK**.
- Click on the **Query Builder** icon to launch the [Query Builder](https://help-innovyze.atlassian.net/wiki/spaces/infowaterpro/pages/18055591) dialog box.
- Choose the appropriate **Data** tab from among the three tabs at the top of the **Query Builder** dialog box.
- Click on the column for the data type you want to query on.
- Choose the operator from the functions and operator section.
- Enter the value that you want as your second operand in the **Value Box**.
- Click **Add** to add the query in the Statement section of the **Query Builder**.
- Click **Validate** to validate your query.
- Click **OK **to save your query and exit from the **Query Builder** dialog box.



To create a query set, from the **InfoWater Pro Browser** →  **Operation** tab highlight the **Query Set folder** and right click and select **New.**  Provide a Query set ID and a description for the new query set.  When created, you are able to add or create the DB Queries that will comprise the Query Set. 


![image](media://d6cc4a86-dd40-481b-b9b3-4e4ff4422f1e)


## ID & Description

The query set ID and description are displayed here.

Tip 1:  In InfoWater Pro, an ID is up to 32 characters long, no spaces, and no symbol characters such as *#, %* etc. (dash "-" and underscore "_" are OK).

Tip 2:  Description is up to 60 characters with spaces, numbers, and symbol characters.

Tip 3:  A good description always helps identify the Query Set.

## Associated DB Queries & Color

This dialog box shows the current DB Queries assigned to the highlighted query set. To adjust the color associated with a DB Query, highlight the desired query and click on the color box under the Association Details section. When the color palette box appears, select a color, and click **OK**.

  - **Delete** - Use this button to remove a DB Query from the active query set. Select the DB Query you want to remove, and click **Delete**.
  - **Color** - Use this button to assign a new color to a DB Query in the active query set. Select the DB Query and click **Color**. Choose the color and click **OK** to associate the color with the DB Query.
  - **Insert** - Use this button to insert a DB Query into the active query set.

## Association details

  - **Color** - Launch the color palette by clicking on the **Color** button. Select the color you want to associate with the DB Query and click **OK**.
  - **DB Query** - Select a previously created database query from the drop-down menu to assign to the query set. Once the desired DB Query is chosen, it is Automatically associated with the Query Set.
  - **Create DB Query** - This launches the [DB Query](https://help-innovyze.atlassian.net/wiki/spaces/infowaterpro/pages/18055591) dialog box allowing you to create a new database query.