r/SQL • • 4d ago

BigQuery BigQuery lessons

There are plenty of good free courses for general SQL, on Postgres, MySQL, SQLite and so on. But I couldn't find one dedicated to BigQuery that works without a BigQuery account. Most of them start with creating a Google Cloud project, or with the sandbox.

We build a BigQuery IDE, Querylab.io, and it turned out it already had what that needs:

  • Its own SQL engine that runs in your browser. That's why they're free, and you don't need to sign up or install anything.
  • Completions and error checks as you type, so you see a typo before you run the query.
  • Every query shows what it would cost on BigQuery. You can ignore it at first, but on a real database a careless query costs money, and it's good to learn that early.

So we built 76 short lessons on top of it. Each one explains one idea with an example, then gives you a few challenges, and the site checks your answer. Some ask you to fix a broken query or to guess the result before you run it.

Most of the practice data is a sample of real UK MOT data. MOT is the yearly inspection every car in the UK over three years old has to pass, and the data is how each car did. Cool dataset btw. There's also a made-up online shop and some website analytics events.

The SQL is BigQuery's. For the basics it's very close to what you'd write anywhere else. There are three levels:

  • SQL from zero: SELECT, GROUP BY, joins, dates, CTEs, window functions (35 lessons)
  • What BigQuery does its own way: cost, partitions, arrays and structs, pipe syntax, scripting (29 lessons)
  • Analytics on Google Analytics 4 data: sessions, funnels, retention (9 lessons)

It works best on a computer.

https://learn.querylab.io/lesson/select-where/

If a lesson confuses you, tell me which one and where you got stuck. I'd love any feedback, and we'll fix it.

7 Upvotes

4 comments sorted by

2

u/Beginning_Finger7892 4d ago

this is actually pretty clever, using a browser engine to simulate bigquery costs without needing a real account. that MOT dataset sounds way more interesting than the usual employee/sales tables too

the cost preview on every query is a nice touch, learned that lesson the hard way when i accidentally scanned a few terabytes of logs once

1

u/querylabio 4d ago

Thanks!

MOT is a fun one, using it you can roast your friends with BMW based on DATA. The full dataset is public in BigQuery if you ever want to play with it on real BigQuery: querylab-io-demo.MotHistoryData.* (just look at the estimate first 😄)

(you can add it in bigquery console - explorer - star a project by name or in Querylab in Settings - BigQuery - add project by id)

2

u/Discordbothost 2d ago

Clarify the first lesson's opening: filtering rows isn't itself what makes a query cheaper. Your date filter prunes partitions; the make/result filters may just reduce returned rows. Keeping that distinction up front would stop beginners treating any WHERE clause as a cost control.

1

u/querylabio 2d ago

You're right, the lesson made it sound like any WHERE saves money. Only the date filter really does here, since the table is partitioned by month. It's also clustered by vehicle_id, test_result and make, but vehicle_id comes first, so filtering on make or result skips very little. Mostly it just gives you fewer rows back. Reworded the lesson to say that.

Thanks. Appreciate the feedback