Skip to contentVarnook
All courses
SQLIntermediate

SQL: Trustworthy Reports

Check report grain, joins, denominators and missing data in SQLite, then transfer the same reasoning to library and event records.

Recommended first: SQL for Data Analysis. This course builds on it, but you can open it now.

Free to browse. You sign in at the first lesson so your progress is saved.

Free includes 3 learning hours each week, across all courses. If you use them up, running code pauses until Monday at 00:00 UK time; you can still read lessons and edit your code. Longer courses can be spread over several weeks. How weekly limits work.

About this course

SQL using SQLite 3.45.2

Runs through sql.js 1.12.0 against a fresh practice database for each run. Syntax and behaviour follow SQLite.

Maintained by Soulstack

Course overview reviewed
Exercise checks verified

Overview review covers the course summary, stated outcomes and final exercise example. Automated verification ran all 9 reference solutions against their checks and confirmed that starter code does not already pass. This is internal verification.

How exercise checks work

What you will be able to do

  • State report grain and repair multiplying joins
  • Define eligible populations and half-open reporting periods
  • Reconcile summaries against underlying facts
  • Investigate fresh-domain reports with missing and boundary data

Put it into practice

What you will make

An event capacity report

The final investigation reports March confirmed booking counts and reserved seats for every event, with remaining capacity bounded at zero.

Output from the completed course exercise, using its supplied practice data. From Fresh-domain investigation: event bookings.

An event capacity report
event_idbooking_countreserved_seatsremaining_seats
8002
42251
71000

Take a look inside

From the first lesson: State the grain. Read an example before starting the exercise yourself.

A fulfilment report promises one row per order, but an order with two products appears twice. State the grain before choosing columns: here the key is the order id. A join to line items changes the grain unless you aggregate back to that key.

You read the explanation, edit the code and run the exercise checks. Your progress is saved after you sign in.

query.sql
SELECT manager_id, COUNT(*) AS peopleFROM staff WHERE manager_id IS NOT NULLGROUP BY manager_id ORDER BY manager_id;

Before you start

Some experience from SQL for Data Analysis is recommended. Times are estimates; practise at your own pace. Every exercise has checks against its brief.

Read how checks, hints and saved work behave. If something is unclear, report a problem with this course and include the lesson link.