0Pricing
Digital Marketing Academy · Lesson

SELECT, WHERE, GROUP BY

Aggregate campaign data.

The Three Verbs

Almost every marketing metric is built from three clauses: SELECT chooses columns, WHERE filters rows, and GROUP BY collapses rows into segments.

Master this trio and you can answer most day-to-day analytics questions on your own.

SELECT channel, SUM(revenue) AS revenue
FROM orders
GROUP BY channel;

SELECT: Picking Columns

SELECT lists what you want back. You can rename columns with AS to make output readable, and compute new values inline.

Keep result sets lean: pull only the columns you actually need, especially on large tables.

SELECT campaign_id AS campaign,
       spend,
       spend * 1.2 AS spend_with_fees
FROM campaigns;

All lessons in this course

  1. Why Marketers Learn SQL
  2. SELECT, WHERE, GROUP BY
  3. Joining Marketing Tables
  4. Cohort and Funnel Queries
← Back to Digital Marketing Academy