---
schema_version: "1"
id: 4402b66d1e831fe8796687aa0d06e1d1b3ab4a8ff3a45698e9342f58f0327a9c
title: Create a Query with a Data Extension
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/mktg/264-0-0/mc_dat_data_extension_query.md
canonical_url: https://help.salesforce.com/s/articleView?id=mktg.mc_dat_data_extension_query.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 872f48eaf738a0158a5a3ef3bbf39faadbcbfaf08db6d32b9d6d5c901a173e08
description: Create a query with data extensions to view your engagement data with your data extension data. For example, view total clicks per region.
products:
  - Marketing
  - Marketing Cloud Intelligence
release: "264"
---
# Create a Query with a Data Extension

Create a query with data extensions to view your engagement data with your data extension data. For example, view total clicks per region.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Intelligence Reports Advanced</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d5615e54">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d5615e54 ">To Create a Query:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d5615e54 ">Create &amp; Edit</td>

          </tr>
        </tbody>
      </table>

To query the data extension you can use SQL or the Query Builder. If you’re using SQL, you can create complex use cases. If you’re using the Query Builder and you want to query both engagement data and extension data in the same query, you must make sure you created a join before creating the query.

In this example, you can see how to query engagement data and data extension data using the Query Builder.

1. On the Queries tab, click **Create New Query**.
2. Name your query.
3. Select **Builder**, and click **Create**.
4. Build your query.
    
    For example, create a query to view total clicks per region. In this example, the dimension is Location (taken from the data extension) and the measurement is email\_sends (taken from the engagement data).
    
    ![data\_extensio\_query](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-mktg-mc_data_management_and_analytics-264-0-0-production-enus/7988f60d-cd94-4b42-8836-dc11773564b5/mc_data_management_and_analytics/images/mc_data_extension_example.png)
5. If you’re using SQL, here’s an example of a join that produces the same results.
    
    ```
    select data_extension.Region, sum(data_extension.email_unique_clicks) 
    from engagement_data left join data_extension on engagement_data.subscriber_id = data_extension.ID 
    group by data_extension.Region
    ```
6. To run the query, click **Run**