Skip to content
SamplePreview build: teacher profiles, ratings, reviews and lesson counts are sample data.
All tutors

SQL for Analysis: First Queries

Write SQL that answers real questions, and check that the answer is right

By Lin Zhao Beginner Data science and statistics 4.5(4) 96 lessons taught Sample

This tutor is free. Your lesson starts right away.

A taste of a lesson

One question and the answer, as this tutor gives it.

SQL for Analysis: First Queries AI tutor following Lin Zhao's plan
Student:

I joined customers to orders and summed customer credit limits by country. The totals are way too high. Why?

Tutor:

That is join fan out. Each customer appears once per order after the join, so a customer with 8 orders has their credit limit counted 8 times. Credit limit lives at the customer level, but your joined table is at the order level. Fix it by summing credit limits from the customers table alone, grouped by country, or by aggregating orders per customer first and then joining. Quick check: count rows in customers, then in your joined result. What numbers do you get?

Written by the teacher as an example. In your lesson the tutor answers your own questions, and like any AI it can be wrong.

What you will be able to do

  • Write SELECT queries with filters, sorting and limits
  • Summarise data with GROUP BY, aggregates and HAVING
  • Combine tables with inner and left joins correctly
  • Handle NULL values without surprises
  • Check query results with row counts and known totals

Lesson plan

6 lessons. Pick one to start there.

  1. 1 Selecting and filtering Retrieve and filter rows to answer a simple question. Start
  2. 2 Summarising with GROUP BY Count, sum and average by group. Start
  3. 3 Filtering groups with HAVING Filter after aggregation and understand query order. Start
  4. 4 Joining tables Combine tables with inner and left joins. Start
  5. 5 NULLs and fan out Avoid the two most common wrong answers in SQL. Start
  6. 6 Checking your answer Verify results before sharing them. Start

Try asking

Tap a question to start a lesson with it.

About this tutor

A free beginner tutor for analysts, marketers, product people and anyone who wants to pull their own numbers from a database. You will write SELECT queries, filter with WHERE, summarise with GROUP BY and aggregate functions, filter groups with HAVING and combine tables with joins. Every lesson pairs a business question with a small set of tables, and you learn to check results: counting rows after joins, understanding how NULL behaves and comparing totals with a known figure. The tutor notes where SQL dialects differ and keeps to standard features.

Reviews

4.5

4 ratingsSample

  • Rashid A.Sample

    Good beginner course. The row count checks saved me from sharing a wrong report.

  • Valentina B.Sample

    I'm a marketer and can now pull my own campaign numbers. The fan out lesson explained a mistake I had made for months.

  • Moses K.Sample

    Free and very well paced. Predicting results before running queries is a great habit.

  • Elise F.Sample

    Clear explanations of NULL. I wanted a bit more on dates, but it explained why dialects differ.

About the teacher

Lin Zhao

Data cleaning, SQL, exploratory analysis and honest charts

9 tutors 4.5(22) 427 lessons taught Sample

I teach the part of data science that takes most of the time: getting data into a shape you can trust, querying it, exploring it and showing it honestly. I came to data from operations work, where reports drove real decisions and a wrong join could cost a week. I teach by handing you small, deliberately messy tables and asking...

See Lin's profile and tutors