SalesforceSalesforce Marketing Cloud SpecialistMarketing Cloud DeveloperMedium
How do you write a SQL query in Automation Studio to output results to a data extension?
Suggested answer
In Automation Studio, a Query Activity uses SQL SELECT statements. The output DE must be specified in the Query Activity configuration — you cannot use SQL INSERT INTO syntax directly; Marketing Cloud routes the results to the target DE. Example:
SELECT
c.SubscriberKey,
c.EventDate AS ClickDate,
c.URL,
m.FirstName
FROM _Click c
JOIN MyMasterDE m ON c.SubscriberKey = m.SubscriberKey
WHERE c.IsUnique = 1
AND c.EventDate >= DATEADD(DAY, -7, GETDATE())
The target DE must have matching column names. Overwrite mode replaces all rows; Append mode adds rows. Query Activities have a 30-minute execution time limit.
Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.
Community comments (0)
No comments yet.
Sign in or create a free account to add a comment. Comments are moderated before they appear.