Courses / Course 03

Data Modelling

Shape data so people can query it without a guide: facts, dimensions and history.

  • IntermediateLevel
  • about 1.5 hoursTo complete
  • 6 lessonsWith checked exercises
  • FreeNo account needed

What you will learn

  • Choose and test the grain of a table
  • Build fact and dimension tables
  • Answer questions with a star schema
  • Keep full history with SCD Type 2
  • Write point-in-time joins

Syllabus

  1. 1
    Why model data? Start with the grain

    Source systems store data for running the business. Analytics needs it shaped differently, and every good model starts with one question: what is one row?

    12 min
  2. 2
    Fact tables

    Facts record events and the numbers you add up: here, every product sold in a delivered order.

    14 min
  3. 3
    Dimension tables

    Dimensions describe the who, what and when of each fact, and make filtering and grouping easy.

    14 min
  4. 4
    The star schema

    Put facts and dimensions together, and most business questions become a join and a GROUP BY.

    12 min
  5. 5
    Keeping history: slowly changing dimensions

    Customers move and change plans. Keep every version, so old reports stay true.

    16 min
  6. 6
    Mini project: revenue by where customers really lived

    Join facts to the version of the customer that was true on the day of each order.

    20 min

The data you will use

Nordic Shop

A small online shop based in Finland that sells electronics, home goods, sports gear, books and outdoor clothing. Customers sign up, place orders on the website or in the app, and each order contains one or more products.

Tables: customers, products, orders, order_items

Nordic Shop raw feeds

The same Nordic Shop, but before anyone cleaned the data. Every night a job loads the day's orders from the shop system, the payment provider sends its own file, and the customer system keeps a log of every change to a customer.

Tables: raw_orders_feed, payments, customer_history, order_events, customer_contacts, deletion_requests

The lesson Keeping history: slowly changing dimensions walks you through every table and column. Under every code box you can also open a list of the tables and what each column means.

Learn in public on GitHub

Do the exercises in the browser, or in the public course repo so your work shows on your GitHub profile.

  1. Fork the course repo

    One click on GitHub gives you your own copy with every exercise and dataset.

  2. Solve and open a pull request

    Put your answers in your own folder and open a pull request. A bot checks them and comments with ✅ or ❌.

  3. Join the graduates

    Finished a course? Add your name to GRADUATES.md. Your work stays on your GitHub profile for recruiters to see.

Open this course on GitHub →

What you will build

A star schema with full customer history for an online shop.

Based on a real project: E-commerce CDC Pipeline