Segmenting Your Data Using the Query


  • What tools can be used for Segmentation?
  • What is the Query?
  • How does the Query work?
  • How do you create a Query Activity?

Segmentation Tools

Segmenting your data is important because it allows you to send the right message to the right person at the right time.

There are two tools within Marketing Cloud which allows you to Segment your data:

  1. Drag & drop
    • Allows you to segment your data that’s in a list or data extension, also known as a data view
  2. Query
    • Allows you to segment or retrieve data that in a single data extension or located in multiple data extensions
    • You use SQL (Structured Query Language) to define your criteria
    • Results are placed in a data extension
    • The data extension that the results are placed in will need to be created before defining the query activity
    • Eg: Select * from Subscribers where Age > 40 or Salary > 60000

Data View Tables

  • Data view tables are tables that contain behaviour related information
    • Opens
    • Clicks
    • Bounces
    • Unsubscribes
  • There are 17 different data views
  • Contain 6 months of data
  • Must be enabled on your account


  • SQL is a programming language which allows you to manipulate and retrieve data
  • The SQL support for the Query Activity is based on SQL Server 2005 capabilities
  • Only SELECT statements to data extensions or data views in an account or int he parent account
  • Nested Queries
    • UNION
    • JOIN
    • GROUP BY
  • Conditional Statements
    • IF Constructs
    • CASE Statements

Create a Query

  • The query activity is located in the Email Application under Interactions –> Query
  • Click on Create
  • Type in a Name
  • External Key and Description are optional
    • External Key is used when executing the query through the API
  • In the query workspace, type or copy and paste in your select statement
    • Select * from NTOSubscribers where Sport = ‘running’
  • Click check syntax
  • Once the query has been validated, select the data extension on where you want the query activity to place the results
  • After selecting the data extension, the final parameter is to select the Update Type
    • Overwrite
    • Update
    • Append






Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.