Skip to content
Curriculum

SQL for analysis

Asking the database directly: filtering, summarising, joining tables and window functions.

5 units22 bitesAbout 66 min

What this course covers

SQL is the language almost every data team uses to get numbers out of a database. This course starts with SELECT, WHERE, GROUP BY and JOIN, with real SQL you can run inside the lesson on a small online shop's data. It then covers how analytics tables are organised (facts, dimensions and grain), joins that do not inflate numbers, the aggregation patterns people ask for most, and window functions for rankings and running totals. Every query is checked against the right answer, including traps such as NULL and the WIB time zone.

New to AI? Start with AI & data fundamentals.

Part of the career paths:Data analystData engineerData scientist

What you will be able to do

  • Write SELECT, WHERE, GROUP BY and JOIN queries that answer business questions
  • Choose the right join and spot one that inflates numbers
  • Read the fact-and-dimension structure of a data warehouse
  • Use window functions for rankings, running totals and period-over-period comparisons

Units and bites

  1. Unit 15 bitesAbout 15 min

    SQL basics

    Asking the database directly: selecting, filtering, grouping and joining tables.

    1. SELECT and WHERE

      Taking the columns you need and filtering to the rows that matter.

      3 min
    2. GROUP BY and aggregates

      SUM, COUNT and AVG per city or per month, and how WHERE differs from HAVING.

      3 min
    3. Joining tables

      INNER and LEFT JOIN, and the join that quietly doubles your rows.

      3 min
    4. Dates and time zones

      Cutting data by month correctly when the database stores time in UTC.

      3 min
    5. NULLs and edge cases

      Why COUNT(*) and COUNT(column) differ, and how to handle missing values safely.

      3 min
  2. Unit 25 bitesAbout 15 min

    SQL & data modelling

    Fact and dimension tables, grain, and schemas that make analysts fast and numbers consistent.

    1. App tables vs analytics tables

      Why a schema that suits the app does not necessarily suit reporting.

      3 min
    2. Facts and dimensions

      The events you measure and the context that describes them: the star schema.

      3 min
    3. Choosing the grain

      What does one row represent? The most important decision in a fact table.

      3 min
    4. Joins that inflate numbers

      Joining orders to items and then summing the order total: a classic mistake.

      3 min
    5. Changing dimensions

      A customer moves city: do old reports change with them, or stay as they were?

      3 min
  3. Unit 34 bitesAbout 12 min

    Joins in depth

    INNER, LEFT, anti-joins and self-joins: choosing the join that answers the question, without losing or duplicating rows.

    1. INNER and LEFT joins compared

      Which join quietly drops customers with no orders, and when that is what you want.

      3 min
    2. Anti-joins: finding what's missing

      Customers who never bought, products that never sold: LEFT JOIN ... WHERE ... IS NULL and NOT EXISTS.

      3 min
    3. Self-joins and repeat buyers

      Joining a table to itself to find each customer's second order.

      3 min
    4. Joining on dates and ranges

      Matching orders to the promotion running at the time, such as the 12.12 sale.

      3 min
  4. Unit 44 bitesAbout 12 min

    Aggregation and GROUP BY patterns

    The summaries people ask for most: conditional aggregation, COUNT DISTINCT, by week and by month, and funnels.

    1. Conditional aggregation with CASE

      Paid revenue and cancelled orders in one query, one row per city.

      3 min
    2. COUNT DISTINCT pitfalls

      Why daily unique buyers cannot be added up into monthly unique buyers.

      3 min
    3. Grouping by week and month

      Truncating time in WIB, weeks that start on Monday, and months with no data.

      3 min
    4. Funnel counts in SQL

      From product view to checkout to payment: counting each stage without counting anyone twice.

      3 min
  5. Unit 54 bitesAbout 12 min

    Window functions for analysis

    Calculating alongside rows instead of collapsing them: rankings, running totals and period-over-period comparisons.

    1. ROW_NUMBER for the latest record

      Taking the latest row per customer, and removing duplicates safely.

      3 min
    2. Running totals

      Cumulative revenue through Ramadan with SUM() OVER (ORDER BY ...).

      3 min
    3. LAG for period-over-period

      Month-on-month growth without a self-join, and what happens in the first month.

      3 min
    4. Ranking within groups

      The top three products in every city with PARTITION BY, and how RANK differs from DENSE_RANK.

      3 min

Questions about this course

Learning

How long does SQL for analysis take?

About 66 minutes in all: 5 units made of 22 bites of about three minutes each, and every bite ends with a quick check. You can do one bite a day or several in a row.

Do I need to know how to code?

Not to start. The foundations explain every idea in plain words first; where a course uses SQL or Python, it teaches it from the beginning, with a playground in the lesson.

Where should I start?

If you are new to AI, begin with AI & data fundamentals. If you know the job you want, follow its career path; SQL for analysis has a place in it.

When can I start learning?

Datamew is coming to iOS and Android soon. There is no release date or price announced yet: join the waitlist and we will tell you when the app is out.

Is it available in Bahasa Indonesia?

Yes. Datamew is written in English and Bahasa Indonesia.

Help Center

More courses

Curriculum

Read while you wait

Guides from the Datamew team, free on the web today.

Waitlist

Be first on the app

Leave your email and we will tell you the day Datamew lands on your phone. One email at launch, no spam.