# Query Activity SQL with data views and joins

*Marketing Cloud Engagement Developer Study Guide · Data Management · Last updated November 3, 2026 · https://www.certifyforce.com/study-guide/marketing-cloud-engagement-developer/data-management/query-activity-sql-with-data-views-and-joins*

What a SQL Query activity accepts and rejects, how it writes to its target data extension, how joins, UNION, CASE and GROUP BY shape the rows it returns, and which system data view holds what, for how long, in which time zone and at which business-unit level.

- Certification: Salesforce Marketing Cloud Engagement Developer
- Exam section: Data Management
- Study guide: https://www.certifyforce.com/study-guide/marketing-cloud-engagement-developer

**Official exam objective:**

> Given a scenario, apply SQL to produce the desired results.

## What the exam expects

- Spot the statements, comments and constructs a SQL Query activity rejects, and rewrite them with supported SQL.
- Choose Append, Update or Overwrite for the target data extension.
- Predict the rows a JOIN, UNION, CASE, aggregate or GROUP BY query returns, including NULL handling.
- Reference data extensions correctly: names with spaces, names versus external keys, and the `ENT.` prefix.
- Pick the data view and column that hold the data, and adjust for its retention, time zone and business-unit scope.
- Key terms: **SQL Query activity** (the Automation Studio activity that runs a SELECT and writes the result to a data extension); **target data extension** (where results land); **data action** (Append, Update or Overwrite); **system data view** (a read-only, Salesforce-created table such as `_Sent`); **Enterprise 2.0** (a parent account with child business units).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Statements | SELECT only, against data extensions or data views | [SQL Reference](https://help.salesforce.com/s/articleView?id=mktg.mc_as_sql_reference.htm&language=en_US&type=5) |
| Comments | Open-ended `--` comments are unsupported | [SQL Reference](https://help.salesforce.com/s/articleView?id=mktg.mc_as_sql_reference.htm&language=en_US&type=5) |
| Isolation | READ UNCOMMITTED, equal to WITH (NOLOCK) | [SQL Reference](https://help.salesforce.com/s/articleView?id=mktg.mc_as_sql_reference.htm&language=en_US&type=5) |
| Timeout | 30 minutes | [SQL Reference](https://help.salesforce.com/s/articleView?id=mktg.mc_as_sql_reference.htm&language=en_US&type=5) |
| Known issue | A Decimal field used in a query doesn't produce decimal output | [SQL Reference](https://help.salesforce.com/s/articleView?id=mktg.mc_as_sql_reference.htm&language=en_US&type=5) |
| Primary key size | Don't set a data extension primary key over 1700 bytes | [SQL Reference](https://help.salesforce.com/s/articleView?id=mktg.mc_as_sql_reference.htm&language=en_US&type=5) |
| Overwrite | Deletes all existing target rows first | [Build a SQL Query Activity](https://help.salesforce.com/s/articleView?id=mktg.mc_as_use_the_sql_query_activity.htm&type=5&language=en_US) |
| Engagement view dates | Central Standard Time, no Daylight Saving Time | [Data View: Open](https://help.salesforce.com/s/articleView?id=mktg.mc_as_data_view_open.htm&type=5&language=en_US) |
| `_Job` DeliveredTime | NULL for any triggered send | [Data View: Job](https://help.salesforce.com/s/articleView?id=mktg.mc_as_data_view_job.htm&type=5&language=en_US) |
| `_Subscribers` | Returns results at the Enterprise level only | [Data Views](https://help.salesforce.com/s/articleView?id=mktg.mc_as_data_views.htm&type=5&language=en_US) |

## Check yourself

- Why should you drag columns into the query editor instead of typing their names?
- When does a send that just finished show up in `_Sent`?
- Does a Unicode search string in a query need an N prefix?
- Why can a query that reaches past six months of a data view still be a concern?

## Sources

- [SQL Reference](https://help.salesforce.com/s/articleView?id=mktg.mc_as_sql_reference.htm&language=en_US&type=5)
- [Build a SQL Query Activity](https://help.salesforce.com/s/articleView?id=mktg.mc_as_use_the_sql_query_activity.htm&type=5&language=en_US)
- [Retrieving and Segmenting Data with a SQL Query Activity](https://help.salesforce.com/s/articleView?id=mktg.mc_as_using_the_query_activity.htm&type=5&language=en_US)
- [Data Views](https://help.salesforce.com/s/articleView?id=mktg.mc_as_data_views.htm&type=5&language=en_US)
- [Data View: Click](https://help.salesforce.com/s/articleView?id=mktg.mc_as_data_view_click.htm&language=en_US&type=5)
- [Data View: Bounce](https://help.salesforce.com/s/articleView?id=mktg.mc_as_data_view_bounce.htm&type=5&language=en_US)
- [Data View: Open](https://help.salesforce.com/s/articleView?id=mktg.mc_as_data_view_open.htm&type=5&language=en_US)
- [Data View: Sent](https://help.salesforce.com/s/articleView?id=mktg.mc_as_data_view_sent.htm&type=5&language=en_US)
- [Data View: Job](https://help.salesforce.com/s/articleView?id=mktg.mc_as_data_view_job.htm&type=5&language=en_US)
- [Query Data with SQL (Trailhead)](https://trailhead.salesforce.com/content/learn/modules/marketing-cloud-data-management/query-data-with-sql)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 13 linked practice questions, and unlimited timed mock exams are included with the Marketing Cloud Engagement Developer pack (USD $19): https://www.certifyforce.com/practice-exams
