---
schema_version: "1"
id: 111187dd30ad76d004ae399ec2c30cb92bacc08944a30c909e5bf4aac6949649
title: SQL Query Examples
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/mktg/264-0-0/mc_as_sql_query_examples.md
canonical_url: https://help.salesforce.com/s/articleView?id=mktg.mc_as_sql_query_examples.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 9ccea456a853199f88b60698534096c139980ffa77fbad986bfdb6918f305f4a
description: Learn how to build effective SQL queries in Automation Studio by following use cases.
products:
  - Marketing
  - Marketing Cloud Engagement
release: "264"
---
# SQL Query Examples

Learn how to build effective SQL queries in Automation Studio by following use cases.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-mktg-mc_journeys_and_automations-264-0-0-production-enus/e08cdd71-c1c1-4ae5-a5e9-8a6dad583ad4/images/icon_note.png)

Note

- To use these examples, you need a working knowledge of SQL.
- These examples aren’t comprehensive. Be creative, combine use cases, and check out the Trailhead and Stack Exchange communities for more ideas.
- You can copy and paste the code samples, but you must configure them for your setup.
- Data views are covered in a separate, adjacent section of the documentation.

- **[Query: Bounce History](https://help.salesforce.com/s/articleView?id=mktg.mc_as_query_bounce_history.htm&release=264.0.0&type=5)**  
    Find a history of individual bounce responses, and identify how to resolve them.
- **[Query: Journey Builder Bounced Email Messages](https://help.salesforce.com/s/articleView?id=mktg.mc_as_query_journey_builder_bounced_email_messages.htm&release=264.0.0&type=5)**  
    Create a list of contacts to send direct mailers to, based on bounced email messages from Journey Builder.
- **[Query: Journey Builder Sends by Email Across Versions](https://help.salesforce.com/s/articleView?id=mktg.mc_as_query_journey_builder_sends_by_email_across_versions.htm&release=264.0.0&type=5)**  
    Aggregate all Journey Builder email sends across multiple versions of the same journey. Or modify this query to find opens, clicks, bounces, complaints, or unsubscribes across versions during a specific time frame.
- **[Query: Journey Builder Sends in Last 24 Hours](https://help.salesforce.com/s/articleView?id=mktg.mc_as_query_journey_builder_sends_in_last_24_hours.htm&release=264.0.0&type=5)**  
    Find subscribers who were sent an email from a journey in Journey Builder within the last 24 hours. Or, modify this query to find opens, clicks, bounces, complaints, or unsubscribes for an email from Journey Builder during a specific time frame.
- **[Query: Opens in Last 30 Days](https://help.salesforce.com/s/articleView?id=mktg.mc_as_query_opens_in_last_30_days_ref.htm&release=264.0.0&type=5)**  
    Find all unique opens for a specific email over the last 30 days. Or, modify this query to find sends, clicks, bounces, complaints, or unsubscribes for an email during a specific time frame.
- **[Query: Subscriber Status](https://help.salesforce.com/s/articleView?id=mktg.mc_as_query_find_subscriber_status_ref.htm&release=264.0.0&type=5)**  
    Find subscribers on a list and their statuses. Or, find only subscribers with a specific status, such as active or unsubscribed.
- **[Query: Subscribers by Date or Time Frame](https://help.salesforce.com/s/articleView?id=mktg.mc_as_query_find_subscribers_by_date_or_time_frame_ref.htm&release=264.0.0&type=5)**  
    Find subscribers who were added within a specific date or range of dates.
- **[Query: Subscribers in a Publication or Suppression List](https://help.salesforce.com/s/articleView?id=mktg.mc_as_query_find_subscribers_on_a_publication_or_suppression_list_ref.htm&release=264.0.0&type=5)**  
    Find subscribers who were placed on a publication or suppression List. Or, find only subscribers on the list with a specific status, such as active or unsubscribed. If you have problems retrieving suppression list data, contact Salesforce Customer Support to activate this feature.
- **[Query: Subscribers with No Opens or Clicks](https://help.salesforce.com/s/articleView?id=mktg.mc_as_query_find_subscribers_with_no_opens_or_clicks_ref.htm&release=264.0.0&type=5)**  
    Find subscribers who haven’t opened or clicked an email. Use this query for jobs with fewer than 500,000 subscribers. For larger jobs, use intermediate tables.
- **[Query: Top Bounces for a Job](https://help.salesforce.com/s/articleView?id=mktg.mc_as_query_find_top_bounces_for_a_job_ref.htm&release=264.0.0&type=5)**  
    Find the top bounces by percentage for a specific job. Use this query for jobs with fewer than 5,000,000 subscribers.