Tutorvo
Data & Analytics Intermediate

SQL Window Functions in a Spreadsheet: Running Totals, Ranks per Group, Previous-Row Values, Moving Averages & Sessions

Learn what OVER and PARTITION BY really do by building each window function as a formula: running totals, ranks per group, previous and next rows, moving averages and user sessions, with every cell checked as you go.

8 lessons 8 labs 2.2 h Certificate

  • One-time payment
  • 14-day money-back guarantee
  • Secure checkout with Stripe

What you'll build

What you will be able to do

Each lab ends with a concrete result that you build yourself and the checker confirms, cell by cell.

  • Put each customer's total and average next to every single order (the window-function way), work out each order's share of its customer's total, and compare it with a GROUP BY summary that collapses the rows.
  • Build a running total per customer, a running total over all orders that handles two orders on the same day the way a ROWS frame does, and the running share of the month's revenue.
  • Rank coffees inside their category with RANK and DENSE_RANK logic, give every row a unique ROW_NUMBER with a tie-breaker, and flag the top two per category – and see why ties change who is "top 2".
  • Fetch each customer's previous order date (LAG), the days since that order, the change against the previous amount and the next order date (LEAD) – with formulas that work no matter how the log is sorted.
  • Calculate a 7-day moving average over a date window, count how many days are really in each window, compare it with a 7-row moving average across a closed day, and flag revenue spikes against the trend.
  • Sort subscription customers into spend quartiles, give each a percent rank between 0 and 1, split every region into a top and bottom half and find the spend level of the 75th percentile.
  • Write each customer's first order date next to every order, turn it into a cohort label, fetch the amount of the first order and mark the latest order of each customer – and learn why LAST_VALUE so often returns the current row.
  • Turn a raw click log into sessions: the minutes since each user's previous event (LAG), a new-session flag when the gap is over 30 minutes, a running session number per user (a running SUM of the flags) and the number of sessions per user.

About this course

Window functions are where many SQL learners get stuck, because the result looks like magic. Here you take the magic apart: every window function is rebuilt as a spreadsheet formula, so you see exactly which rows it looks at. You start with group totals placed next to each row, compare PARTITION BY with GROUP BY and build running totals per customer, including ties and running shares. You rank rows with ROW_NUMBER, RANK and DENSE_RANK to pick a top-n, use LAG and LEAD to find gaps and changes, and contrast date-based with row-based moving averages. NTILE, PERCENT_RANK, FIRST_VALUE and LAST_VALUE follow. The capstone splits user events into sessions with gap flags and session numbers. For analysts, data engineers and anyone preparing for SQL interviews.

Curriculum

Course content

8 lessons · 8 labs · 2.2 h · final exam

  1. Unlocked when you buy the course
  2. Unlocked when you buy the course
  3. Unlocked when you buy the course
  4. Unlocked when you buy the course
  5. Unlocked when you buy the course
  6. Unlocked when you buy the course
  7. Unlocked when you buy the course
  8. Unlocked when you buy the course
  9. Final exam12 questions, 75% to pass, unlimited retries.

Certificate

Finish with a certificate you can verify

Complete every lesson and pass the final exam to receive a certificate of completion for this course, with a unique credential ID and a public verification page.

  • Names the course, your score and the date of issue
  • A verification link for your CV or LinkedIn profile
  • 12 questions, 75% to pass, unlimited retries.

A Tutorvo certificate confirms that you completed a course. It is not an official or professional qualification.

Illustration. Your certificate shows your own name, course and credential ID.

Before you buy

Questions about this course

Is this a subscription?

No. You pay $9.99 once for this course. There is no subscription and nothing renews automatically. Prices are in US dollars; taxes may be added where required.

What exactly do I get?

All lessons and labs of this course, the final exam and the certificate, including later updates to the course, for as long as Tutorvo offers it. Access is personal and tied to your account.

Can I get a refund?

Yes. If you are not satisfied, email hello@tutorvo.com within 14 days of buying and we refund the course in full via Stripe. The guarantee does not apply once a certificate for the course has been issued to you, or where there are signs of abuse.

When can I start?

Right after payment. Access starts immediately at your request; for consumers in the EU/EEA the statutory right of withdrawal therefore ends once access has begun, while our 14-day money-back guarantee applies regardless.

Do I need Excel or other software?

No. The labs run in a spreadsheet inside your browser on a laptop, tablet or phone. Function names and syntax follow Excel.

Is the certificate an official qualification?

No. It confirms that you completed all lessons of the course and passed its final exam. It is not an official, state-recognised or professional qualification. The name is taken from your profile when the certificate is issued.

Full details are in our Terms · hello@tutorvo.com

$9.99one-time payment
Buy course