AdvancedSQLPuzzles: a T-SQL problem set with answers to read, not just to run
Welcome to my GitHub repository. I hope you enjoy solving these puzzles as much as I have enjoyed creating them.
At a glance
- What is it?
- AdvancedSQLPuzzles is a repository of SQL Server T-SQL puzzles and database articles maintained by Scott Peters, aimed at developers who want to sharpen query writing by solving them. It is a reading collection with per-directory readme files, not a library, a tool or a schema you can install.
- Who is it for?
- AdvancedSQLPuzzles suits a SQL Server developer who wants worked problems to practise against and a database article to read, and who is comfortable with T-SQL dialect specifics. It does not suit a team looking for a tool to adopt, a schema to copy, or a portable SQL exercise set, since everything is written for Microsoft SQL Server unless otherwise noted.
- Can I use it commercially?
- Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
- Is it still maintained?
- Yes. The repository last received commits 51 days ago.
- What is it written in?
- Mainly TSQL, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.
Editorial analysis
A corpus of query problems, scoped to one database dialect
AdvancedSQLPuzzles is a collection of SQL puzzles and database writings kept in one GitHub repository. The stated purpose is modest and honest: the author describes it as a collection of his puzzles and various writings, invites readers to rummage around, and says he is constantly updating the repository.
The technical scope is set in one line and it matters. All SQL in the repository is written in Microsoft SQL Server T-SQL unless otherwise noted. That single clause decides who this collection is for. A developer who writes PostgreSQL, MySQL or SQLite will find the window functions and the date arithmetic readable, but the constructs that make SQL Server distinctive, the dialect-specific syntax, the proprietary functions and the server-side behaviour, are exactly what the puzzles exercise. Somebody learning to be fluent in T-SQL rather than in SQL in general.
The author is Scott Peters, based in Austin, Texas, and he frames the repository around a working relationship with other SQL developers. The route for questions is a GitHub discussion rather than an issue tracker, and he invites new puzzles and tips as well as corrections.
There is also a companion WordPress site at advancedsqlpuzzles.com, described as hosting data analytics projects, Python puzzles and a blog. The repository and the site are separate surfaces with different content, which is worth knowing when you go looking for something you half remember from one of them.
The directory layout is the navigation, and each folder has its own readme
The repository root is small. Four entries carry the whole thing: a directory named `Advanced SQL Puzzles/`, a directory named `Database Articles/`, an `images/` folder for assets, and the top-level `readme.md`.
The two content directories split the collection by kind. Puzzles are questions with a query to write, articles are written treatments of database topics. That separation is the closest thing to a taxonomy in the repository, and it is a useful one for a reader deciding whether they want to solve something or read something.
Navigation works by readme files rather than by an index. The getting started instructions say to clone or download the repository to a local machine and note that readme files are included for each directory to describe its contents. The instruction to contact the author if anything is unclear is the fallback when the per-directory readme does not cover your question.
The top-level readme is a landing page rather than a table of contents. It introduces the collection, states the dialect rule, points to discussions for questions, and closes with a request to report inaccuracies, misspellings, bugs and dead links. It also asks readers to consider giving a star if the contents are informative, which is worth noting only because it tells you the repository is organised for browsing rather than for pulling in as a dependency.
Getting the collection: clone it, because there is nothing to install
There is no install step, no package to add, no schema to load and no command to run. The entire setup is a clone or a download.
git clone https://github.com/smpetersgithub/AdvancedSQLPuzzles.gitThat is deliberately the whole tutorial. The point of the collection is that you open a directory, read its readme, take a puzzle, write a query, and compare your answer against the solutions that sit alongside it in that directory. The repository is the deliverable, not a program that does something to your database.
That framing determines what you can and cannot expect. There is no test harness to run your answer against, since the checks are the expected outputs written by hand. There is no supported way to run the whole corpus against a live server in one pass, because the collection is prose and SQL text rather than an executable suite. And there is no dependency manifest, because nothing here depends on a package.
For a working setup, the practical part is on your side: a SQL Server instance with a scratch database, a way to run T-SQL interactively, and the discipline to write each answer yourself before reading the solution in the directory. The site author notes his own familiarity with the word `SELECT`, which is the tone of the collection: this is a set of problems to be solved, not snippets to be copied.
Where the collection stops working for you
The limits are structural and follow from what the repository is.
The first is the dialect. Everything is T-SQL for SQL Server unless a puzzle says otherwise, so the exercises are not portable to another engine. A team standardising on PostgreSQL gets the reasoning but not the syntax, and any question about how a construct behaves on another database is outside what the collection answers.
The second is the absence of a maintained, versioned artifact. There are no GitHub releases for the repository, so there is no version to pin, no changelog to diff against your local copy, and no upgrade step. The repository was last pushed on 2026-09-02, and the guidance is simply to check back often. For a personal practice set that is fine. For something your team wants to reference from a documentation page with a link, you have no stability guarantee at all.
The third is licensing. The repository records no licence identifier, and the root `readme.md` carries no licence terms. That is a real constraint for reuse. You can read the puzzles, work the problems and use your own solutions anywhere, but if you want to republish a puzzle or a database article, or paste one into internal training documents, the repository does not grant you a licence to do so, and the correct move is to ask the author rather than assume.
The fourth is that the collection is aimed at one person's platform and cadence. The author states the puzzles are his own, so coverage follows his interests, his server version and his spare time rather than a curriculum plan.
Compared with a puzzle site, a book, or a talk
The usual alternatives to a repository like this are interview question lists, a book of SQL puzzles, and conference talks. Each differs in a specific way.
An interview question list is short and portable: a handful of questions with a couple of answers, easy to browse in five minutes. What it lacks is progression. A directory of puzzles where some are warm-ups and some are not gives you a sense of ordering, and the answer text tends to be fuller because each puzzle can be explained at length in its own folder.
A book gives the same progression with editorial structure, and it comes with a coherent voice, exercises with official solutions and a defined difficulty curve. The repository's advantage is that it is not one author's single argument but a working set that keeps growing, and that the answers live next to the questions rather than in a separate answer key.
A talk is the opposite shape: one idea, well explained, in an hour. A directory of database articles is closer to a talk than to a puzzle, which is why the two directories are useful together. An article explains why a technique is shaped the way it is, and the puzzles give you something to do with it.
The other honest comparison is with your own team's query backlog. If you already have a list of slow or awkward queries from production, practising on invented puzzles with clean expected outputs is a different exercise from tuning real ones. The puzzles train the writing of queries, the articles explain the plan. They do not teach you your own data model.
A living repository with no releases and no licence
Maintenance on this project is content maintenance rather than code maintenance. There is no build, no test suite to keep green, no dependency to upgrade and no version to bump. The last push was on 2026-09-02, and the project is not archived.
The upgrade path is therefore a pull. If you have a local clone from a year ago, updating is a fetch and a reset, and the diff is new puzzles and new articles rather than changed behaviour. Nothing in the existing puzzles is expected to change underneath you, which is a genuine benefit of a puzzle collection over a tool.
The cost of that arrangement shows up in discovery. Because there is no index and no tags in the root readme, finding the puzzle that matches a problem you hit at work means reading the per-directory readmes or asking the author in a discussion. That is fine for a browser and slow for a search tool, and it is the honest cost of a personal collection rather than a curated library.
The licensing position deserves one more mention because it is the one thing here that is not merely inconvenient. With no licence file and no licence field, default copyright applies, so reuse beyond personal study is not granted. The author does invite collaborators and welcomes new puzzles, and asks that corrections and bug reports be filed as issues, so the route to reuse is a conversation with him rather than a licence file you can point at.
Editorial conclusion
AdvancedSQLPuzzles suits a SQL Server developer who wants worked problems to practise against and a database article to read, and who is comfortable with T-SQL dialect specifics. It does not suit a team looking for a tool to adopt, a schema to copy, or a portable SQL exercise set, since everything is written for Microsoft SQL Server unless otherwise noted. Before using it, open the readme in the directory you plan to use and check that the dialect assumptions hold for your server version, and confirm the licensing position yourself, because the repository records no licence identifier.
Frequently asked questions
What is AdvancedSQLPuzzles and who is it for?
It is a GitHub repository of SQL puzzles and database articles collected by Scott Peters. The audience is developers who want to practise writing SQL, and all the SQL is written in Microsoft SQL Server T-SQL unless otherwise noted.
How do I get the AdvancedSQLPuzzles collection?
Clone or download the repository to your local machine. There is nothing to install or run: the puzzles live in the `Advanced SQL Puzzles/` directory and the written pieces in `Database Articles/`, each with a readme describing its contents.
Which SQL dialect do the AdvancedSQLPuzzles puzzles use?
All SQL in the repository is written in Microsoft SQL Server T-SQL, unless otherwise noted in the individual puzzle.
Can I ask questions about a solution in AdvancedSQLPuzzles?
Yes. The project directs questions to GitHub discussions, and the author says he is happy to help and explain different solutions. Corrections, misspellings, bugs and dead links can be reported as issues.
What licence does AdvancedSQLPuzzles use?
The repository records no licence identifier and the root readme carries no licence terms. If you want to republish a puzzle or article, ask the author for permission rather than assuming reuse is granted.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/smpetersgithub-advancedsqlpuzzles)Was this useful?