---
title: Creating a SQL Policy
slug: kron-dam-reference-guide-3-8-0/creating-a-sql-policy
description: Learn how to prevent or allow the execution of queries using SQL policies. Follow the steps outlined in this document to navigate to the Session Policy section, open the Policy Key tab, and restrict or permit specific queries or regex. Choose the suitable
docTags: 
createdAt: 2022-08-01T16:22:50.000Z
---

The execution of queries can be prevented or allowed by SQL policies:

1. Navigate to **Policy  Control > Session Policy.**
2. Click the +**Add** button.
3. Next to th&#x65;**&#x20;Policy Key Title.**
4. Select th&#x65;**&#x20;Policy Key Type&#x20;**&#x69;n the opened pop-up
   - Select the white or black key.
5. Enter the query (or regex) to prevent or allow.
6. Select the policy type and element type.
7. Click **Save.**

:::hint{type="info"}
At least one policy key must be assigned to the related realm for SQL proxies.
\*If only black key policies are defined in a realm, all remaining queries will be white key.
\*If only white key polices are defined in a realm, all remaining queries will be black key.
\*If only the “.” regex is defined as white key, all queries are allowed to run.
\*If only the “.” regex is defined as a black key, all queries will be blocked.
:::

![](https://api.archbee.com/api/optimize/g9cApVza9NIhSh0pjZYtA/7ZMcotShytrT1liLKJpeT_image.png "SQL Policy Key Definition / Key Type selection is White Key")

