10 GitHub Repositories to Master SQL for Data Science: A Free Learning Path
Most SQL learners do not quit at SELECT. They stall somewhere later, in the wide and poorly signposted stretch between writing a query that returns the right rows and writing one that a team can trust. Ranking rows without a nest of self joins, reading an execution plan, choosing a schema that survives its second year of analysts: these are not extra keywords to memorize. They are a different kind of skill, and they are rarely taught in sequence.
That gap is the premise behind this reading list of ten free GitHub repositories, arranged not as a pile of links but as a progression. It starts with interview drills and realistic sample data, moves through window functions and query performance, and ends in production analytics. Everything on the path is free, and, importantly, actively maintained.
Here is what is on it, what each repository is actually good for, and how to sequence a study plan around them.
Why learners stall after the basics
The first four SQL commands are easy to teach and easy to test. What comes next is harder to package. Three capabilities separate intermediate from working proficiency:
- Ranking and ordering. Top N per group, running totals, consecutive streaks, medians. All of these are window function territory, and learners who only know
GROUP BYtend to reach for self joins that are slow and hard to debug. - Query performance. Diagnosing a slow query means reading a plan, and plan output is dense text that most tutorials never show.
- Modeling for a team. A one-off query is a personal artifact. A table that analysts can query without asking its author questions is a design problem, not a syntax problem.
The repositories below map onto those three capabilities in roughly that order.
doocs/leetcode: worked interview problems
The doocs/leetcode repository is run by the doocs open source community and maintained mainly by Libin Yang, who commits almost daily. It contains worked solutions to several hundred SQL problems, each tagged Easy, Medium or Hard, each with a written explanation and often more than one approach. The exact count grows over time, so check the repository for the current figure.
The tagging matters less than the recurring themes. Across the set, the same patterns keep returning: ranking, running totals, consecutive streaks, medians, and finding rows with no match. Those five shapes cover a surprising share of analytical SQL in practice, and seeing them solved several ways is a faster route to fluency than grinding random problems.
Data Engineering Handbook: modeling, not just queries
The Data Engineering Handbook, started by Zach Wilson of the education platform DataExpert.io, is one of the most starred repositories on the list. Wilson still makes most of the commits.
It is mostly a curated index rather than a tutorial: a free 4-week beginner bootcamp, a free 6-week intermediate bootcamp, an interviews page, a hands-on projects list, and more than 25 recommended books. The bootcamp material goes deep on data modeling, specifically fact tables, dimension tables, and how to design tables that analysts can query easily. That is the part of SQL that interview prep never covers and that production work depends on.
test_db: realistic data at realistic scale
The classic Employees sample database, test_db, has a schema designed by Giuseppe Maxia, with data originally generated by Fusheng Wang and Carlo Zaniolo at Siemens Corporate Research. Per its README, it holds roughly 300,000 employee records and 2.8 million salary entries, and it appears in MySQL’s own documentation.
Two properties make it unusually good for practice. First, the salary table is large enough that careless queries are noticeably slow, which gives you feedback that a 50-row toy table never will. Second, it is tested regularly against current MySQL, MariaDB and Percona releases, and the README now also covers PostgreSQL 16 and 17, so you are not learning against a schema that breaks on install.
DuckDB: an analytical engine inside your notebook
DuckDB runs in-process inside Python scripts or notebooks, with no server to manage. It reads CSV, Parquet, JSON and Excel files directly, and supports window functions, nested subqueries, and complex types such as arrays and structs. The citation file lists Mark Raasveldt and Hannes Mühleisen as authors; the code is owned by the non-profit DuckDB Foundation, with commercial support from DuckDB Labs. The project ships tagged releases on a regular cadence, and the main branch receives daily commits.
For learners, the appeal is friction. You can point a query at a Parquet file on disk and start practicing window functions in the same session, without provisioning anything. If you want to understand where the project is heading beyond single files, our explainer on DuckLake 1.0: DuckDB’s SQL-Native Lakehouse Format, Explained for Engineers covers the lakehouse layer built on top of it.
PEV2: making EXPLAIN readable
PEV2, the PostgreSQL Explain Visualizer 2, turns EXPLAIN plan text into a clickable tree. It is built and maintained by Dalibo, a PostgreSQL company, and credits the original pev project by Alex Tatiyants, first written in 2016 and no longer updated. PEV2 still receives regular commits.
You can use it with no installation at explain.dalibo.com, or download a single HTML file and run it locally. Paste a plan, see which node dominates the runtime, and the abstract advice about indexes and sequential scans suddenly has a target.
Data Engineering Zoomcamp: SQL across three engines
The Data Engineering Zoomcamp is a free course with tens of thousands of stars. It teaches SQL on BigQuery, DuckDB and dbt, which is a useful combination: a managed warehouse, a local analytical engine, and a transformation tool that most modern data teams now expect candidates to recognize. It is the natural bridge from practicing queries to shipping them.
The production analytics layer
The final stretch of the list is about production analytics with dbt. Once you can write window functions and read a plan, the remaining skill is turning queries into versioned, tested, documented models that other people depend on. dbt is the tool most teams reach for here: it gives you version control, tests and documentation around SQL rather than ad hoc scripts. This is the point at which SQL stops being a solo exercise. The Zoomcamp above already includes dbt sections, so it doubles as the entry point to this layer.
How to sequence the path
A workable order, based on the structure of the list and our own editorial judgment about dependencies:
- Interview practice and realistic data. Start with doocs/leetcode for pattern exposure, and load test_db alongside it so that at least some of your practice runs against millions of rows.
- Window functions and query performance. Move to DuckDB for fast iteration on analytical queries, then use PEV2 the first time a query feels slow. Reading plans is a skill that compounds.
- Modeling and production analytics. Work through the Data Engineering Handbook’s bootcamp material on fact and dimension tables, then the Zoomcamp’s dbt sections. When your practice queries grow into scripts, 7 Python Design Patterns That Make Data Science Code Maintainable covers the structural habits that keep them readable.
Reproducibility notes before you commit
Free and popular is not the same as current. Before building a study plan around any of these, check three things:
- Maintenance cadence. Commit frequency is a rough proxy for whether fixes land. doocs/leetcode and DuckDB both see near-daily activity; PEV2 gets regular commits; the Handbook is driven mainly by one maintainer, which is worth knowing.
- Sample data freshness and version coverage. test_db’s regular testing against current MySQL, MariaDB and Percona releases, plus its PostgreSQL 16 and 17 coverage, is exactly the signal to look for. A sample database that only installs on a three-year-old release will cost you more time than it saves.
- Release versus main branch. Most of these projects tag releases while main moves daily. Pin your practice environment to a release unless you specifically want to track changes.
None of this requires paid tooling or an account. It requires reading a README before trusting it, which is itself a data engineering habit worth forming early.