> For the complete documentation index, see [llms.txt](https://docs.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.collibra.com/data-quality-self-hosted/core-concepts/dq-rules/rule-builder/working-with-the-rule-workbench/create-a-data-quality-rule-with-sql-assistant-for-data-quality.md).

# Create a data quality rule with SQL Assistant for Data Quality

[SQL Assistant for Data Quality](/data-quality-self-hosted/core-concepts/navigation/dataset-overview/sql-assistant-for-data-quality/about-sql-assistant-for-data-quality.md) uses Collibra AI to automatically write and troubleshoot SQL queries. When working on a Pullup dataset, the type of SQL that SQL Assistant for Data Quality generates depends on the rule type. For instance, if your rule type is Freeform SQL, the SQL generated by SQL Assistant for Data Quality is Spark SQL, whereas a Native SQL rule returns the SQL specific to the datasource. Likewise, Pushdown datasets always return SQL native to the job source.

The Prompts are organized in two sections: **Basic** and **Advanced**.

Basic options for SQL query suggestions provided by SQL Assistant for Data Quality include:

<table><thead><tr><th width="152">Option</th><th>Description</th></tr></thead><tbody><tr><td>Generate Rule</td><td>Collibra AI suggests a Spark SQL query to check where in your table, column, or view your input criteria are met.</td></tr><tr><td>Troubleshoot Rule</td><td>When a SQL syntax error occurs, you can use SQL Assistant for Data Quality to automatically troubleshoot and fix the error.</td></tr></tbody></table>

Advanced options for SQL query suggestions provided by SQL Assistant for Data Quality include:

<table><thead><tr><th width="152">Option</th><th>Description</th></tr></thead><tbody><tr><td>Categorical</td><td>Collibra AI suggests a SQL query to detect categorical outliers.</td></tr><tr><td>Dupe</td><td>Collibra AI suggests a SQL query to detect duplicate values.</td></tr><tr><td>Record</td><td>Collibra AI suggests a SQL query to check for values that appear on a previous day but not for the next day.</td></tr><tr><td>Pattern</td><td>Collibra AI suggests a SQL query to check for infrequent combinations that appear less than 5 percent of the time in the columns you specify.</td></tr><tr><td>Frequency Distribution</td><td>Collibra AI suggests a SQL query to check for the frequency distribution of all values within a column.</td></tr></tbody></table>

## Requirements and permissions

To use SQL Assistant for Data Quality, you need to:

* Have an active integration with Collibra Platform configured on the Admin Console > [Integrations](/data-quality-self-hosted/integrations/configuring-a-new-integration.md) screen.

  <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>Only the Credentials step of the Integration Setup is required. You do not need to map connections, tenants, dimensions, or layers to use SQL Assistant for Data Quality.</p></div>
* Set AI\_PLATFORM\_PATH to `TRUE` (default) on the Admin Console > [Application Configuration Settings](/data-quality-self-hosted/admin-configuration/admin-console/configuration-settings/application-configuration-settings.md) screen.
* Set AI\_TENANT to `TRUE` on the Admin Console > [Application Configuration Settings](/data-quality-self-hosted/admin-configuration/admin-console/configuration-settings/application-configuration-settings.md) screen.
* To use the SQL Assistant for Data Quality with an OAuth-based Data Quality & Observability (self-hosted) integration with Collibra Platform, you must have Data Quality & Observability (self-hosted) version 2026.03 or later.
* If you use an OAuth-based integration with Collibra Platform, register the OAuth application with Collibra Platform as the application type. If you register it as an Integration application type, SQL Assistant for Data Quality requests fail with an invalid scope error.
* To generate rule suggestions with SQL Assistant for Data Quality over an OAuth integration, you must use a Platform token. When you register the OAuth application in Collibra Platform, set the application type to **Platform**. An Integration-type application does not receive the scope required for rule suggestion requests, and results in an `invalid_scope` error.

## Steps

### Basic options

{% tabs %}
{% tab title="Generate Rule" %}
{% stepper %}
{% step %}
Open the [Dataset Rules](/data-quality-self-hosted/core-concepts/dq-rules/rule-builder/working-with-dataset-rules.md) page of your dataset.
{% endstep %}

{% step %}
From the Dataset Rules page, there are two ways to open the Rule Workbench.

1. From an existing rule on the Rules tab, click **Actions**, then click **Edit**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens with the preferences of your existing rule.
2. Click **Add Rule** in the upper right corner to create a new rule.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens.
   {% endstep %}

{% step %}
In the upper right corner of the Rule Workbench SQL editor, click Collibra AI.\ <i class="fa-chevrons-right">:chevrons-right:</i> The SQL Assistant for Data Quality tool appears.
{% endstep %}

{% step %}
From the Prompt dropdown menu, select Generate Rule.

{% hint style="info" %}
Generate Rule is the default option.
{% endhint %}
{% endstep %}

{% step %}
In the query input field, enter a plain language prompt.

{% hint style="success" %}
When there are many columns in your dataset, you may need to scroll down to the bottom of the input field to enter your column names.
{% endhint %}

**Examples**

* "high is more than 50"
* "find all of the unique values in Column1 and show how many records exist for each"
* "state is not Michigan, California, or Illinois"
* "compare the 2 dates 2018-01-13 to 2018-01-14 - write 2 separate queries for each date, using trade date - write as a common table expression for tables a and b - join using symbol column - use a join to identify which values are in 2018-01-14 that are not in 2018-01-13 - the goal is to find values that are missing from the previous day"
  {% endstep %}

{% step %}
Click **Submit to Collibra AI**.\ <i class="fa-chevrons-right">:chevrons-right:</i> SQL Assistant for Data Quality generates your SQL query and displays the suggested query when it completes.
{% endstep %}

{% step %}
Choose one of the following options:

1. Click **Copy to Editor** to automatically apply the suggested query to the SQL editor on the Dataset Overview modal.
2. Click **Copy to Clipboard** to copy the suggested query to your computer's clipboard, allowing you to paste the query elsewhere.
3. Click **Close** to exit the SQL Assistant for Data Quality tool without copying the suggested query.
4. Rewrite your prompt and click **Submit to Collibra AI** to generate a new SQL rule suggestion.
   {% endstep %}
   {% endstepper %}
   {% endtab %}

{% tab title="Troubleshoot Rule" %}
When a SQL syntax error occurs, you can use SQL Assistant for Data Quality to automatically troubleshoot and fix the error.

{% stepper %}
{% step %}
Open the [Dataset Rules](/data-quality-self-hosted/core-concepts/dq-rules/rule-builder/working-with-dataset-rules.md) page of your dataset.
{% endstep %}

{% step %}
From the Dataset Rules page, there are two ways to open the Rule Workbench.

1. From an existing rule on the Rules tab, click **Actions**, then click **Edit**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens with the preferences of your existing rule.
2. Click **Add Rule** in the upper right corner to create a new rule.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens.
   {% endstep %}

{% step %}
In the upper right corner of the Rule Workbench SQL editor, click Collibra AI.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Collibra AI tool appears.
{% endstep %}

{% step %}
In the SQL editor, enter an invalid SQL query that returns a syntax error.

<i class="fa-glasses-round">:glasses-round:</i> Example: `SELECT * fomr public.nyse2 were onpe > 4.75`

***

{% endstep %}

{% step %}
In the upper right corner of the SQL editor, click Collibra AI.\ <i class="fa-chevrons-right">:chevrons-right:</i> The SQL Assistant for Data Quality tool appears.
{% endstep %}

{% step %}
From the Prompt dropdown menu, select **Troubleshoot Rule**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The SQL Assistant for Data Quality tool shows the prompt to rewrite and fix your SQL query, an overview of the exception message, the SQL query that caused the error, the table and column names in your query, and helpful troubleshooting tips.

{% hint style="info" %}
You can optionally click the <img src="https://4121921244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWCrP7Albs8DfJjIQxUxw%2Fuploads%2Fgit-blob-fa5db85d1fedb24e596acef061a9d093ca3ea006%2Fedit-large%402x.png?alt=media" alt="" data-size="line"> above and to the right of the overview text to manually edit the troubleshooting prompt.
{% endhint %}
{% endstep %}

{% step %}
Click **Submit to Collibra AI**.\ <i class="fa-chevrons-right">:chevrons-right:</i> SQL Assistant for Data Quality troubleshoots your SQL query and displays the suggested query when it completes.
{% endstep %}

{% step %}
Choose one of the following options:

1. Click **Copy to Editor** to automatically apply the suggested query to the SQL editor on the Dataset Overview modal.
2. Click **Copy to Clipboard** to copy the suggested query to your computer's clipboard, allowing you to paste the query elsewhere.
3. Click **Close** to exit the SQL Assistant for Data Quality tool without copying the suggested query.
4. Rewrite your prompt and click **Submit to Collibra AI** to generate a new SQL rule suggestion.
   {% endstep %}
   {% endstepper %}
   {% endtab %}
   {% endtabs %}

### Advanced options

{% tabs %}
{% tab title="Categorical" %}
{% stepper %}
{% step %}
Open the [Dataset Rules](/data-quality-self-hosted/core-concepts/dq-rules/rule-builder/working-with-dataset-rules.md) page of your dataset.
{% endstep %}

{% step %}
From the Dataset Rules page, there are two ways to open the Rule Workbench.

1. From an existing rule on the Rules tab, click **Actions**, then click **Edit**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens with the preferences of your existing rule.
2. Click **Add Rule** in the upper right corner to create a new rule.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens.
   {% endstep %}

{% step %}
In the upper right corner of the Rule Workbench SQL editor, click Collibra AI.\ <i class="fa-chevrons-right">:chevrons-right:</i> The SQL Assistant for Data Quality tool appears.
{% endstep %}

{% step %}
From the Prompt dropdown menu, select **Categorical**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The prompt automatically uses the correct SQL type of your rule. For instance, a Freeform rule utilizes Spark SQL, while data source-specific SQL adapts based on the connection type of your dataset.
{% endstep %}

{% step %}
In the query input field, enter the names of the columns in your dataset to include in the SQL query.

<i class="fa-glasses-round">:glasses-round:</i> Example: In this example, the default placeholder column "sale\_state" will be replaced with the user-defined "cm\_claimant\_age" in the categorical outlier SQL suggestion.

![An example of a prompt for categorical outliers](https://4121921244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWCrP7Albs8DfJjIQxUxw%2Fuploads%2Fgit-blob-f0f7f90e342ea73d29254d303382ae3bd200cb20%2Fdq-sql-assistant-categorical-prompt.png?alt=media)

***

{% hint style="success" %}
When there are many columns in your dataset, you may need to scroll down to the bottom of the input field to enter your column names.
{% endhint %}
{% endstep %}

{% step %}
Click **Submit to Collibra AI**.\ <i class="fa-chevrons-right">:chevrons-right:</i> SQL Assistant for Data Quality generates your SQL query and displays the suggested query when it completes.

<i class="fa-glasses-round">:glasses-round:</i> Example: ![Example of the SQL suggestion for categorical](https://4121921244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWCrP7Albs8DfJjIQxUxw%2Fuploads%2Fgit-blob-e6e828adf5c01243a8b352db3dfac7306a1b4425%2Fdq-sql-assistant-categorical-suggestion.png?alt=media)

***

{% endstep %}

{% step %}
Choose one of the following options:

1. Click **Copy to Editor** to automatically apply the suggested query to the SQL editor on the Dataset Overview modal.
2. Click **Copy to Clipboard** to copy the suggested query to your computer's clipboard, allowing you to paste the query elsewhere.
3. Click **Close** to exit the SQL Assistant for Data Quality tool without copying the suggested query.
4. Rewrite your prompt and click **Submit to Collibra AI** to generate a new SQL suggestion.
   {% endstep %}
   {% endstepper %}
   {% endtab %}

{% tab title="Dupe" %}
{% stepper %}
{% step %}
Open the [Dataset Rules](/data-quality-self-hosted/core-concepts/dq-rules/rule-builder/working-with-dataset-rules.md) page of your dataset.
{% endstep %}

{% step %}
From the Dataset Rules page, there are two ways to open the Rule Workbench.

1. From an existing rule on the Rules tab, click **Actions**, then click **Edit**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens with the preferences of your existing rule.
2. Click **Add Rule** in the upper right corner to create a new rule.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens.
   {% endstep %}

{% step %}
In the upper right corner of the Rule Workbench SQL editor, click Collibra AI.\ <i class="fa-chevrons-right">:chevrons-right:</i> The SQL Assistant for Data Quality tool appears.
{% endstep %}

{% step %}
From the Prompt dropdown menu, select **Dupe**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The prompt automatically uses the correct SQL type of your rule. For instance, a Freeform rule utilizes Spark SQL, while data source-specific SQL adapts based on the connection type of your dataset.
{% endstep %}

{% step %}
In the query input field, enter the name of the column in your dataset to include in the SQL query.

<i class="fa-glasses-round">:glasses-round:</i> Example: In this example, the default placeholder column "email" will be replaced with the user-defined "cm\_denied\_reason1" in the duplicate value SQL suggestion.

![An example of a prompt for duplicate values](https://4121921244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWCrP7Albs8DfJjIQxUxw%2Fuploads%2Fgit-blob-9822a78ed887beec1c0768a8d8d7d243ec54c200%2Fdq-sql-assistant-dupe-prompt.png?alt=media)

***

{% hint style="success" %}
When there are many columns in your dataset, you may need to scroll down to the bottom of the input field to enter your column name.
{% endhint %}
{% endstep %}

{% step %}
Click **Submit to Collibra AI**.\ <i class="fa-chevrons-right">:chevrons-right:</i> SQL Assistant for Data Quality generates your SQL query and displays the suggested query when it completes.

<i class="fa-glasses-round">:glasses-round:</i> Example: ![Example of the SQL suggestion for dupes](https://4121921244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWCrP7Albs8DfJjIQxUxw%2Fuploads%2Fgit-blob-37cc68cdb4d484c8846f98aa0f6faf35e21dc4d4%2Fdq-sql-assistant-dupe-suggestion.png?alt=media)

***

{% endstep %}

{% step %}
Choose one of the following options:

1. Click **Copy to Editor** to automatically apply the suggested query to the SQL editor on the Dataset Overview modal.
2. Click **Copy to Clipboard** to copy the suggested query to your computer's clipboard, allowing you to paste the query elsewhere.
3. Click **Close** to exit the SQL Assistant for Data Quality tool without copying the suggested query.
4. Rewrite your prompt and click **Submit to Collibra AI** to generate a new SQL suggestion.
   {% endstep %}
   {% endstepper %}
   {% endtab %}

{% tab title="Record" %}
{% stepper %}
{% step %}
Open the [Dataset Rules](/data-quality-self-hosted/core-concepts/dq-rules/rule-builder/working-with-dataset-rules.md) page of your dataset.
{% endstep %}

{% step %}
From the Dataset Rules page, there are two ways to open the Rule Workbench.

1. From an existing rule on the Rules tab, click **Actions**, then click **Edit**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens with the preferences of your existing rule.
2. Click **Add Rule** in the upper right corner to create a new rule.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens.
   {% endstep %}

{% step %}
In the upper right corner of the Rule Workbench SQL editor, click Collibra AI.\ <i class="fa-chevrons-right">:chevrons-right:</i> The SQL Assistant for Data Quality tool appears.
{% endstep %}

{% step %}
From the Prompt dropdown menu, select **Record**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The prompt automatically uses the correct SQL type of your rule. For instance, a Freeform rule utilizes Spark SQL, while data source-specific SQL adapts based on the connection type of your dataset.
{% endstep %}

{% step %}
In the query input field, enter the names of the columns in your dataset to include in the SQL query.

<i class="fa-glasses-round">:glasses-round:</i> Example: In this example, the default placeholder columns "vendor\_type" and "transaction\_date" will be replaced with the user-defined "cm\_claim\_status" and "cm\_bdos" in the SQL suggestion for record changes.

![An example of a prompt for record changes](https://4121921244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWCrP7Albs8DfJjIQxUxw%2Fuploads%2Fgit-blob-6aa5813652bf3b847725db2576bf7f5f8a78911f%2Fdq-sql-assistant-record-prompt.png?alt=media)

***

{% hint style="warning" %}
You must specify one column with numeric data and one date column.
{% endhint %}

{% hint style="success" %}
When there are many columns in your dataset, you may need to scroll down to the bottom of the input field to enter your column names.
{% endhint %}
{% endstep %}

{% step %}
Click **Submit to Collibra AI**.\ <i class="fa-chevrons-right">:chevrons-right:</i> SQL Assistant for Data Quality generates your SQL query and displays the suggested query when it completes.

<i class="fa-glasses-round">:glasses-round:</i> Example: ![Example of the SQL suggestion for records](https://4121921244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWCrP7Albs8DfJjIQxUxw%2Fuploads%2Fgit-blob-db4f8337db9ab117f02f754ef6bae87c324e0aec%2Fdq-sql-assistant-record-suggestion.png?alt=media)

***

{% endstep %}

{% step %}
Choose one of the following options:

1. Click **Copy to Editor** to automatically apply the suggested query to the SQL editor on the Dataset Overview modal.
2. Click **Copy to Clipboard** to copy the suggested query to your computer's clipboard, allowing you to paste the query elsewhere.
3. Click **Close** to exit the SQL Assistant for Data Quality tool without copying the suggested query.
4. Rewrite your prompt and click **Submit to Collibra AI** to generate a new SQL suggestion.
   {% endstep %}
   {% endstepper %}
   {% endtab %}

{% tab title="Pattern" %}
{% stepper %}
{% step %}
Open the [Dataset Rules](/data-quality-self-hosted/core-concepts/dq-rules/rule-builder/working-with-dataset-rules.md) page of your dataset.
{% endstep %}

{% step %}
From the Dataset Rules page, there are two ways to open the Rule Workbench.

1. From an existing rule on the Rules tab, click **Actions**, then click **Edit**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens with the preferences of your existing rule.
2. Click **Add Rule** in the upper right corner to create a new rule.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens.
   {% endstep %}

{% step %}
In the upper right corner of the Rule Workbench SQL editor, click Collibra AI.\ <i class="fa-chevrons-right">:chevrons-right:</i> The SQL Assistant for Data Quality tool appears.
{% endstep %}

{% step %}
From the Prompt dropdown menu, select **Pattern**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The prompt automatically uses the correct SQL type of your rule. For instance, a Freeform rule utilizes Spark SQL, while data source-specific SQL adapts based on the connection type of your dataset.
{% endstep %}

{% step %}
In the query input field, enter the names of the columns in your dataset to include in the SQL query.

<i class="fa-glasses-round">:glasses-round:</i> Example: In this example, the default placeholder columns "sale\_state" and "state\_tax" will be replaced with the user-defined "cm\_diagnosis\_code" and "cm\_denied\_reason1" in the SQL suggestion for pattern detection.

![An example of a prompt for pattern detection](https://4121921244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWCrP7Albs8DfJjIQxUxw%2Fuploads%2Fgit-blob-c4a5f0a7037ae4c0b633153c5588d455fdce3d18%2Fdq-sql-assistant-pattern-prompt.png?alt=media)

***

{% hint style="success" %}
When there are many columns in your dataset, you may need to scroll down to the bottom of the input field to enter your column names.
{% endhint %}
{% endstep %}

{% step %}
Click **Submit to Collibra AI**.\ <i class="fa-chevrons-right">:chevrons-right:</i> SQL Assistant for Data Quality generates your SQL query and displays the suggested query when it completes.

<i class="fa-glasses-round">:glasses-round:</i> Example: ![Example of the SQL suggestion for patterns](https://4121921244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWCrP7Albs8DfJjIQxUxw%2Fuploads%2Fgit-blob-e738c93abdab6b2debfeb5f44a35b0b904c2d37a%2Fdq-sql-assistant-pattern-suggestion.png?alt=media)

***

{% endstep %}

{% step %}
Choose one of the following options:

1. Click **Copy to Editor** to automatically apply the suggested query to the SQL editor on the Dataset Overview modal.
2. Click **Copy to Clipboard** to copy the suggested query to your computer's clipboard, allowing you to paste the query elsewhere.
3. Click **Close** to exit the SQL Assistant for Data Quality tool without copying the suggested query.
4. Rewrite your prompt and click **Submit to Collibra AI** to generate a new SQL suggestion.
   {% endstep %}
   {% endstepper %}
   {% endtab %}

{% tab title="Frequency Distribution" %}
{% stepper %}
{% step %}
Open the [Dataset Rules](/data-quality-self-hosted/core-concepts/dq-rules/rule-builder/working-with-dataset-rules.md) page of your dataset.
{% endstep %}

{% step %}
From the Dataset Rules page, there are two ways to open the Rule Workbench.

1. From an existing rule on the Rules tab, click **Actions**, then click **Edit**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens with the preferences of your existing rule.
2. Click **Add Rule** in the upper right corner to create a new rule.\ <i class="fa-chevrons-right">:chevrons-right:</i> The Rule Workbench opens.
   {% endstep %}

{% step %}
In the upper right corner of the Rule Workbench SQL editor, click Collibra AI.\ <i class="fa-chevrons-right">:chevrons-right:</i> The SQL Assistant for Data Quality tool appears.
{% endstep %}

{% step %}
From the Prompt dropdown menu, select **Frequency Distribution**.\ <i class="fa-chevrons-right">:chevrons-right:</i> The prompt automatically uses the correct SQL type of your rule. For instance, a Freeform rule utilizes Spark SQL, while data source-specific SQL adapts based on the connection type of your dataset.
{% endstep %}

{% step %}
In the query input field, enter the name of the column in your dataset to include in the SQL query.

<i class="fa-glasses-round">:glasses-round:</i> Example: In this example, a SQL query for frequency distribution will be suggested for the column "cm\_denied\_reason1".

![An example of a prompt for frequency distribution](https://4121921244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWCrP7Albs8DfJjIQxUxw%2Fuploads%2Fgit-blob-f875f82e154bde7e5aa39f13ca1241692cbbf76b%2Fdq-sql-assistant-frequency-distribution-prompt.png?alt=media)

***

{% hint style="success" %}
When there are many columns in your dataset, you may need to scroll down to the bottom of the input field to enter your column name.
{% endhint %}
{% endstep %}

{% step %}
Click **Submit to Collibra AI**.\ <i class="fa-chevrons-right">:chevrons-right:</i> SQL Assistant for Data Quality generates your SQL query and displays the suggested query when it completes.

<i class="fa-glasses-round">:glasses-round:</i> Example: ![Example of the SQL suggestion for frequency distribution](https://4121921244-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWCrP7Albs8DfJjIQxUxw%2Fuploads%2Fgit-blob-5c4b1b7b3339beedea96d5444fe9f467f1ba6f9f%2Fdq-sql-assistant-frequency-distribution-suggestion.png?alt=media)

***

{% endstep %}

{% step %}
Choose one of the following options:

1. Click **Copy to Editor** to automatically apply the suggested query to the SQL editor on the Dataset Overview modal.
2. Click **Copy to Clipboard** to copy the suggested query to your computer's clipboard, allowing you to paste the query elsewhere.
3. Click **Close** to exit the SQL Assistant for Data Quality tool without copying the suggested query.
4. Rewrite your prompt and click **Submit to Collibra AI** to generate a new SQL suggestion.
   {% endstep %}
   {% endstepper %}
   {% endtab %}
   {% endtabs %}
